private void OnValidate(object sender, RoutedEventArgs e) { // Update defaults Dependencies.Properties.Settings.Default.PeViewerPath = PeviewerPath; int TreeDepth = Dependencies.Properties.Settings.Default.TreeDepth; if (Int32.TryParse(TreeDepthValue.Text, out TreeDepth)) { Dependencies.Properties.Settings.Default.TreeDepth = TreeDepth; } if (TreeBuildCombo.SelectedItem != null) { Dependencies.Properties.Settings.Default.TreeBuildBehaviour = TreeBuildCombo.SelectedItem.ToString(); } if (BinaryCacheCombo.SelectedItem != null) { bool newValue = (bool)(new BinaryCacheOption()).ConvertBack(BinaryCacheCombo.SelectedItem, null, null, null); if (Dependencies.Properties.Settings.Default.BinaryCacheOptionValue != newValue) { System.Windows.MessageBox.Show("The binary caching preference has been modified, you need to restart Dependencies for the modifications to be actually reloaded."); } Dependencies.Properties.Settings.Default.BinaryCacheOptionValue = newValue; } Dependencies.Properties.Settings.Default.Font = FontFamilyListItem.GetDisplayName(SelectedFontFamily); this.Close(); }
private void fontFamilyList_SelectionChanged(object sender, SelectionChangedEventArgs e) { FontFamilyListItem item = FontFamilyList.SelectedItem as FontFamilyListItem; if (item != null) { SelectedFontFamily = item.FontFamily; } }
protected override void OnInitialized(EventArgs e) { base.OnInitialized(e); InitializeFontFamilyList(); SelectedFontFamily = new FontFamily(Dependencies.Properties.Settings.Default.Font); SelectListItem(FontFamilyList, FontFamilyListItem.GetDisplayName(SelectedFontFamily)); FontFamilyList.SelectionChanged += new SelectionChangedEventHandler(fontFamilyList_SelectionChanged); }
private void OnValidate(object sender, RoutedEventArgs e) { // Update defaults Dependencies.Properties.Settings.Default.PeViewerPath = PeviewerPath; if (TreeBuildCombo.SelectedItem != null) { Dependencies.Properties.Settings.Default.TreeBuildBehaviour = TreeBuildCombo.SelectedItem.ToString(); } Dependencies.Properties.Settings.Default.Font = FontFamilyListItem.GetDisplayName(SelectedFontFamily); this.Close(); }
private void InitializeFontFamilyList() { ICollection <FontFamily> familyCollection = FontFamilyCollection; if (familyCollection != null) { FontFamilyListItem[] items = new FontFamilyListItem[familyCollection.Count]; int i = 0; foreach (FontFamily family in familyCollection) { items[i++] = new FontFamilyListItem(family); } Array.Sort <FontFamilyListItem>(items); foreach (FontFamilyListItem item in items) { FontFamilyList.Items.Add(item); } } }