/// <inheritdoc/> public void Initialize(IServiceSettingProvider settingProvider) { _settingProvider = settingProvider; _ignoredApplications = _settingProvider.GetSetting <List <IgnoredApplication> >("IgnoredApplications"); if (CoreHelper.IsUnitTesting()) { _clipboardHook = new ClipboardHook(new Window()); } else { _clipboardHook = new ClipboardHook(Application.Current.MainWindow); } _clipboardHook.ClipboardChanged += ClipboardHook_ClipboardChanged; Resume(); Logger.Instance.Information($"{GetType().Name} initialized."); }
public MainWindowVM( ILanguageService lang, KanaBoardVM hiraganaBoard, KanaBoardVM katakanaBoard, UsageDataSourcePreviewVM usageDataSourceVm, KanjiRadicalLookupControlVM kanjiLookupVm, Func <string> aboutTextProvider) { HiraganaBoard = hiraganaBoard; KatakanaBoard = katakanaBoard; this.aboutTextProvider = aboutTextProvider; UsageDataSourceVM = usageDataSourceVm; TextBuffers.Add(new TextBufferVM("Scratchpad", lang)); TextBuffers.Add(new TextBufferVM("Main", lang)); ClipboardTextBuffer = new TextBufferVM("Clipboard", lang); KanjiLookupVM = kanjiLookupVm; hook = new ClipboardHook(); hook.ClipboardChanged += SetContent; PlaceInClipboard = new RelayCommand((p) => { var codePoint = (CodePoint)p; Clipboard.SetText(codePoint.ToString()); }); SendToCurrent = new RelayCommand(() => { if (CurrentTextBuffer == null) { return; } CurrentTextBuffer.RawOutput = ClipboardTextBuffer.RawOutput; }); SendToScratchpad = new RelayCommand(() => { TextBuffers[0].RawOutput = ClipboardTextBuffer.RawOutput; }); SearchWeb = new RelayCommand(query => { if (CurrentTextBuffer == null) { return; } if (SearchEngineIndex == -1) { return; } LaunchWebBrowserAt(SearchEngines[SearchEngineIndex].BuildSearch(CurrentTextBuffer.SelectionInfo.GetRequest().QueryText)); }); SwitchToTab = new RelayCommand(tab => { switch ((string)tab) { case "project": TabIndex = 0; break; case "usage1": TabIndex = 1; break; case "hiragana": TabIndex = 3; break; case "kanji": TabIndex = 4; break; case "katakana": TabIndex = 5; break; ; } }); DataSourceForceRefresh = new RelayCommand(() => { usageDataSourceVm.Search(usageDataSourceVm.Request); }); }
protected override void IdeRegisterMenus() { // Clipboard Viewer RegisterAction(CreateEmptyMenu(MenuItemLocation.Child, Lextm.OpenTools.ShareUtils.MenuRootDefault, MenuClipboard, "Clipboard")); RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "ClipboardViewMenu", 0, "Clipboard Viewer...", new EventHandler(DoOpenClipboardViewer))); // Separator RegisterAction(CreateSeparatorMenu(MenuItemLocation.Child, MenuClipboard)); // Paste Commented code RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "PasteKeepSelectedMenu", 0, "Paste Keep Selected", new EventHandler(DoPasteKeepSelected))); // Paste Commented code RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "PasteCommentedMenu", 24662, // Ctrl Shift P "Paste Commented", new EventHandler(DoPasteCommented))); // Paste Commented code RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "PasteAsStringMenu", 0, "Paste As String", new EventHandler(DoPasteAsString))); // Send file path to clipboard RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "CopyFilePathToClipboardMenu", 0, "Send folder path to clipboard", new EventHandler(DoCopyFilePathToClipboard))); // Send file name to clipboard RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "CopyFileNameToClipboardMenu", 0, "Send file path to clipboard", new EventHandler(DoCopyFileNameToClipboard))); // Append selection to clipboard RegisterAction(CreateActionMenu(MenuItemLocation.Child, MenuClipboard, "AppendToClipboardMenu", 0, "Append selection to clipboard", new EventHandler(DoAppendToClipboard))); fClipboardHook = new ClipboardHook(); fClipboardHook.Changed += new EventHandler(ClipboardChanged); fClipboardHook.Create(); }