private void OnFirstActivation(object sender, EventArgs eventArgs) { Activated -= OnFirstActivation; Dispatcher.InvokeAsync(async() => { var updateMargins = Utility.Debounce(() => Dispatcher.Invoke(() => EditorMargins = CalculateEditorMargins()), 50); App.UserSettings.PropertyChanged += (o, args) => { if (args.PropertyName == nameof(App.UserSettings.SinglePaneMargin)) { updateMargins(); } if (args.PropertyName == nameof(App.UserSettings.GitHubMarkdown)) { Preview.UpdatePreview(Editor); } }; SizeChanged += (s, e) => updateMargins(); updateMargins(); LoadCommandLineOrLastFile(); Application.Current.Activated += OnActivated; NewVersion = !await Utility.IsCurrentVersion(); TitleBarTooltip(); }); }
public MainWindow( ISpellCheckProvider spellCheckProvider, ISnippetManager snippetManager) { DataContext = this; InitializeComponent(); SpellCheckProvider = spellCheckProvider; SnippetManager = snippetManager; Closing += OnClosing; Activated += OnFirstActivation; IsVisibleChanged += OnIsVisibleChanged; Editor.PropertyChanged += EditorOnPropertyChanged; Editor.TextChanged += (s, e) => Preview.UpdatePreview(((Editor)s)); Editor.ScrollChanged += (s, e) => Preview.SetScrollOffset(e); }
public MainWindow( IMarkdownConverter markdownConverter, ISpellCheckProvider spellCheckProvider, ISnippetManager snippetManager) { InitializeComponent(); MarkdownConverter = markdownConverter; SpellCheckProvider = spellCheckProvider; SnippetManager = snippetManager; Loaded += OnLoaded; Closing += OnClosing; SizeChanged += (s, e) => CalculateEditorMargins(); Editor.PropertyChanged += EditorOnPropertyChanged; Editor.TextChanged += (s, e) => Preview.UpdatePreview(Editor.Text); Editor.ScrollChanged += (s, e) => Preview.SetScrollOffset(e); }
public MainWindow( ISpellCheckProvider spellCheckProvider, ISnippetManager snippetManager) { InitializeComponent(); _vm = (MainWindowViewModel)DataContext; _vm.MainWindow = this; _vm.SpellCheckProvider = spellCheckProvider; _vm.SnippetManager = snippetManager; Closing += _vm.OnClosing; Activated += _vm.OnFirstActivation; IsVisibleChanged += _vm.OnIsVisibleChanged; Editor.PropertyChanged += _vm.EditorOnPropertyChanged; Editor.TextChanged += (s, e) => Preview.UpdatePreview((Editor)s); Editor.ScrollChanged += (s, e) => Preview.SetScrollOffset(s, e); }
public MainWindow( IMarkdownConverter commonMarkConverter, IMarkdownConverter githubMarkdownConverter, ISpellCheckProvider spellCheckProvider, ISnippetManager snippetManager) { DataContext = this; InitializeComponent(); CommonMarkConverter = commonMarkConverter; GitHubMarkdownConverter = githubMarkdownConverter; UpdateMarkdownConverter(); SpellCheckProvider = spellCheckProvider; SnippetManager = snippetManager; Closing += OnClosing; Activated += OnActivated; IsVisibleChanged += OnIsVisibleChanged; Editor.PropertyChanged += EditorOnPropertyChanged; Editor.TextChanged += (s, e) => Preview.UpdatePreview(((Editor)s)); Editor.ScrollChanged += (s, e) => Preview.SetScrollOffset(e); }
private void OnActivated(object sender, EventArgs eventArgs) { Activated -= OnActivated; Dispatcher.InvokeAsync(() => { var updateMargins = Utility.Debounce(() => Dispatcher.Invoke(() => EditorMargins = CalculateEditorMargins()), 50); App.UserSettings.PropertyChanged += (o, args) => { if (args.PropertyName == nameof(App.UserSettings.SinglePaneMargin)) { updateMargins(); } if (args.PropertyName == nameof(App.UserSettings.GitHubMarkdown)) { UpdateMarkdownConverter(); Preview.UpdatePreview(Editor); } }; SizeChanged += (s, e) => updateMargins(); updateMargins(); LoadCommandLineOrLastFile(); }); }
private void ExecutePrintHtml(object sender, ExecutedRoutedEventArgs e) => Preview.Print();
private void ExecuteUpdatePreview(object sender, ExecutedRoutedEventArgs e) => Preview.UpdatePreview(Editor);