public ClipboardExtensions(object owner) { _host = WpfHost.Current; // This class may be accessed before the Window is loaded // if the Clipboard is somehow accessed really early. if (_host.IsLoaded) { HostLoaded(null, null); } else { // Hook for native events _host.Loaded += HostLoaded; } void HostLoaded(object sender, RoutedEventArgs e) { _host.Loaded -= HostLoaded; var win = Window.GetWindow(_host); var fromDependencyObject = PresentationSource.FromDependencyObject(win); _hwndSource = fromDependencyObject as HwndSource; if (_pendingStartContentChanged) { StartContentChanged(); } } }
public CustomTaskPane ShowTaskPane() { if (!Globals.ThisAddIn.CustomTaskPanes.Any()) { var service = new DocumentSerivce(Globals.ThisAddIn.Application.ActiveDocument); _mistakesListVM = new MistakesListViewModel(service, _spellChecker); var control = new WpfHost(); control.Host.Child = new MistakesList(_mistakesListVM); _taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(control, "Kurdspell"); } _taskPane.Visible = true; return(_taskPane); }