private void ChooseFont() { XPathDocumentContent xpathDocumentContent = this.GetSelectedXPathDocumentContent(); if (xpathDocumentContent == null) { return; } FontChooserLite fontChooser = new FontChooserLite(); fontChooser.Owner = this; fontChooser.WindowStartupLocation = WindowStartupLocation.CenterOwner; TreeView xpathDocumentContentTreeView = xpathDocumentContent.TreeView; fontChooser.SetPropertiesFromObject(xpathDocumentContentTreeView); if (!fontChooser.ShowDialog().Value) { return; } fontChooser.ApplyPropertiesToObject(xpathDocumentContentTreeView); // save the new font settings XmlExplorer.Properties.Settings settings = Properties.Settings.Default; settings.FontFamilyName = xpathDocumentContentTreeView.FontFamily.ToString(); settings.FontSize = xpathDocumentContentTreeView.FontSize; settings.Save(); foreach (object item in this.dockingManager.Documents) { XPathDocumentContent otherXPathDocumentContent = item as XPathDocumentContent; if (otherXPathDocumentContent == null) { continue; } if (otherXPathDocumentContent == xpathDocumentContent) { continue; } fontChooser.ApplyPropertiesToObject(otherXPathDocumentContent.TreeView); } }
protected override void OnStartup(System.Windows.StartupEventArgs e) { try { base.OnStartup(e); XmlExplorer.Properties.Settings settings = XmlExplorer.Properties.Settings.Default; /* * according to this article: http://blogs.msdn.com/rprabhu/articles/433979.aspx * manual upgrade of settings is required, but only should only be done when the version number changes */ if (settings.UpgradeNeeded) { settings.Upgrade(); settings.UpgradeNeeded = false; settings.Save(); } Application.Current.Resources.MergedDictionaries.Add( Application.LoadComponent( new Uri("XmlExplorer;component/XPathNavigatorTemplates.xaml", UriKind.Relative)) as ResourceDictionary); MainWindow window = new MainWindow(); window.Show(); foreach (string arg in e.Args) { window.Open(new FileInfo(arg)); } window.CheckForUpdates(); } catch (Exception ex) { HandleException(ex); this.Shutdown(1); } }