private void OpenMenuItem_Click(object sender, EventArgs e) { if (FontDialog.ShowDialog() == DialogResult.OK) { Stopwatch timer = new Stopwatch(); foreach (string fontFile in FontDialog.FileNames) { string fontFileName = Path.GetFileName(fontFile); FontInformation info = null; Exception fontException = null; timer.Restart(); try { info = FontInformation.Read(fontFile); } catch (Exception ex) { fontException = ex; } timer.Stop(); if (info != null) { OutputList.Items.Add($"{timer.Elapsed.TotalMilliseconds}ms {fontFileName} > {info.FamilyName} {info.Style}"); } else { OutputList.Items.Add($"{timer.Elapsed.TotalMilliseconds}ms {fontFileName} > {fontException.Message}"); } } } }
public FreeFontsViewModel() { Title = "Free"; var fonts = FontInformation.FontAwesomeFree(); Fonts = fonts.ToObservableCollection(); }
public ProFontsViewModel() { Title = "Pro"; var fonts = FontInformation.FontAwesomePro(); Fonts = fonts.ToObservableCollection(); }
public static string ReadUserStringValue(FontInformation information) { RegistryKey hkcu = Registry.CurrentUser; //HKCU Registry var key = hkcu.OpenSubKey(information.Path); var keyvalue = key.GetValue("CaptionFont"); return(null); }
public static void ReadFontSizeValue(FontInformation information) { RegistryKey hkcu = Registry.CurrentUser; //HKCU Registry var pathkey = hkcu.OpenSubKey(information.Path); var keyvalue = pathkey.GetValue(information.Key); if (keyvalue != null && keyvalue is byte[] values) { var fontsize = values[0]; information.Size = fontsize; } }
private void Initialize() { CaptionFontInformation = new FontInformation("Captions", "Title bar and Caption buttons", 9); SecondarytitlebarInformation = new FontInformation("Secondary caption bar", "Small captions", 9); MenuInformation = new FontInformation("Menu bar", "Menu and Ribbons", 9); MessageBoxInformation = new FontInformation("Messagebox bar", "Messagebox and contextmenu", 9); IconInformation = new FontInformation("Icon Caption", "Icon and explorer descriptions", 9); StatusbarInformation = new FontInformation("Status bar", "For status bar", 9); BorderInformation = new IntegerInformation("Border", "Window Padding", 1); if (!WPFService.IsDesignMode()) { InitializeSystemValues(); } }
public static void WriteFontSizeValue(FontInformation information) { RegistryKey hkcu = Registry.CurrentUser; //HKCU Registry var pathkey = hkcu.OpenSubKey(information.Path, true); var keyvalue = pathkey.GetValue(information.Key); if (keyvalue != null && keyvalue is byte[] values && information.Size <= byte.MaxValue && information.Size >= byte.MinValue) { values[0] = (byte)information.Size; try { pathkey.SetValue(information.Key, values); } catch (Exception ex) { string k = ""; } } }