- Better-EN5 插件:基于官方示例,注册3个右键菜单项 - Manager 管理器:横版5标签布局,深色主题 WPF 应用 - 自定义 Fluent 安装器:无边框窗口,圆角,淡入淡出动画 - 删除旧代码,移除 SDK 自动安装器 - 三个项目全部编译通过(0 错误)
73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using System.Threading.Tasks;
|
|
using Cvte.Composition;
|
|
using Cvte.EasiNote;
|
|
using Cvte.Windows.Localization;
|
|
using BetterEN5.UI;
|
|
|
|
namespace BetterEN5;
|
|
|
|
class Program : dotnetCampus.EasiPlugins.EasiPlugin
|
|
{
|
|
protected override Task OnRunningAsync()
|
|
{
|
|
if (EN.CommandOptions.IsCloud)
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
if (EN.App.IsReady)
|
|
{
|
|
Run();
|
|
}
|
|
else
|
|
{
|
|
EN.App.Ready += App_Ready;
|
|
}
|
|
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
private void App_Ready(object? sender, EventArgs e)
|
|
{
|
|
EN.App.Ready -= App_Ready;
|
|
Run();
|
|
}
|
|
|
|
private async void Run()
|
|
{
|
|
await Task.Delay(TimeSpan.FromSeconds(3));
|
|
ExportUIItems();
|
|
}
|
|
|
|
private void ExportUIItems()
|
|
{
|
|
var manager = Container.Current.Get<IUIItemManager>();
|
|
|
|
manager.Append(c => new ExportInkMenuItem(), new UIItemAttribute(UIItemPurposes.BoardEditMenu));
|
|
manager.Append(c => new ImportInkMenuItem(), new UIItemAttribute(UIItemPurposes.BoardEditMenu));
|
|
manager.Append(c => new ManagerMenuItem(), new UIItemAttribute(UIItemPurposes.BoardEditMenu));
|
|
|
|
_ = System.Windows.Application.Current.Dispatcher.InvokeAsync(() =>
|
|
{
|
|
Lang.Sources.Add(new DictionaryLanguageSource
|
|
{
|
|
[new CultureInfo("zh-CHS")] = new Dictionary<string, string>
|
|
{
|
|
{ "Lang.BoardEditContextMenu.ExportInk", "导出墨迹" },
|
|
{ "Lang.BoardEditContextMenu.ImportInk", "导入墨迹" },
|
|
{ "Lang.BoardEditContextMenu.Manager", "Better-Seewo 管理" },
|
|
},
|
|
[new CultureInfo("en")] = new Dictionary<string, string>
|
|
{
|
|
{ "Lang.BoardEditContextMenu.ExportInk", "Export Ink" },
|
|
{ "Lang.BoardEditContextMenu.ImportInk", "Import Ink" },
|
|
{ "Lang.BoardEditContextMenu.Manager", "Better-Seewo Manager" },
|
|
},
|
|
});
|
|
});
|
|
}
|
|
}
|