Fix build errors

This commit is contained in:
2023-04-25 16:34:13 +02:00
parent a0d9a11538
commit bde131f422
9 changed files with 189 additions and 125 deletions

View File

@@ -1,3 +1,5 @@
using Avalonia;
using Avalonia.Input.Platform;
using FileTime.App.Core.Services;
namespace FileTime.GuiApp.Services;
@@ -6,7 +8,8 @@ public class SystemClipboardService : ISystemClipboardService
{
public async Task CopyToClipboardAsync(string text)
{
if (global::Avalonia.Application.Current?.Clipboard is { } clipboard)
var clipboard = AvaloniaLocator.Current.GetService<IClipboard>();
if (clipboard is not null)
{
await clipboard.SetTextAsync(text);
}

View File

@@ -88,12 +88,16 @@ public class WindowsContextMenuProvider : IContextMenuProvider
}
else if (shellKey.GetValue("ExtendedSubCommandsKey") is string extendedCommands)
{
var rootMenu = new MenuItem() {Header = text, Icon = image};
var rootMenuItems = new List<object>();
ProcessRegistryKey(Registry.ClassesRoot.OpenSubKey(extendedCommands), rootMenuItems, folderPath);
rootMenu.Items = rootMenuItems.ToArray();
var rootMenu = new MenuItem {Header = text, Icon = image};
foreach (var item in rootMenuItems)
{
rootMenu.Items.Add(item);
}
menuItems.Add(rootMenu);
}
}