private void SnippetsWindow_Loaded(object sender, RoutedEventArgs e) { string initialValue = null; if (Model.Configuration.Snippets.Count > 0) { ListSnippets.SelectedItem = Model.Configuration.Snippets[0]; initialValue = Model.Configuration.Snippets[0].SnippetText; } editor = new MarkdownEditorSimple(WebBrowserSnippet, initialValue); editor.IsDirtyAction = () => { string val = editor.GetMarkdown(); if (val != null && Model.ActiveSnippet != null) { Model.ActiveSnippet.SnippetText = val; } return(true); }; Dispatcher.InvokeAsync(() => { ListSnippets.Focus(); }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); }
private void SnippetsWindow_Loaded(object sender, RoutedEventArgs e) { var winPos = SnippetsAddinConfiguration.Current.WindowPosition; if (!winPos.CenterInMainWindow && winPos.Height != 0 && winPos.Width != 0) { Top = winPos.Top; Left = winPos.Left; Height = winPos.Height; Width = winPos.Width; WindowUtilities.EnsureWindowIsVisible(this); } string initialValue = null; if (Model.Configuration.Snippets.Count > 0) { ListSnippets.SelectedItem = Model.Configuration.Snippets[0]; initialValue = Model.Configuration.Snippets[0].SnippetText; } editor = new MarkdownEditorSimple(WebBrowserSnippet, initialValue); editor.IsDirtyAction = () => { string val = editor.GetMarkdown(); if (val != null && Model.ActiveSnippet != null) { Model.ActiveSnippet.SnippetText = val; } return(true); }; Dispatcher.InvokeAsync(() => { ListSnippets.Focus(); }, System.Windows.Threading.DispatcherPriority.ApplicationIdle); }