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(); 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 { { "Lang.BoardEditContextMenu.ExportInk", "导出墨迹" }, { "Lang.BoardEditContextMenu.ImportInk", "导入墨迹" }, { "Lang.BoardEditContextMenu.Manager", "Better-Seewo 管理" }, }, [new CultureInfo("en")] = new Dictionary { { "Lang.BoardEditContextMenu.ExportInk", "Export Ink" }, { "Lang.BoardEditContextMenu.ImportInk", "Import Ink" }, { "Lang.BoardEditContextMenu.Manager", "Better-Seewo Manager" }, }, }); }); } }