private void Window_Closing(object sender, CancelEventArgs e) { isRunning = false; gHook.unhook(); var isItalic = NpsBlock.FontStyle == FontStyles.Italic; var isUnderline = Equals(NpsBlock.TextDecorations, TextDecorations.Underline); var cvt = new FontFamilyConverter(); AppConfig.SetAppConfig("Exists", "True"); AppConfig.SetAppConfig("Font", cvt.ConvertToString(NpsBlock.FontFamily)); AppConfig.SetAppConfig("Italic", isItalic.ToString()); AppConfig.SetAppConfig("Underline", isUnderline.ToString()); AppConfig.SetAppConfig("Gradation", isGradation.ToString()); var fontClr = ((SolidColorBrush)NpsBlock.Foreground).Color; AppConfig.SetAppConfig("FontColor", $"{fontClr.A},{fontClr.R},{fontClr.G},{fontClr.B}"); if (MainGrid.Background is SolidColorBrush) { var backClr = ((SolidColorBrush)MainGrid.Background).Color; AppConfig.SetAppConfig("Background", $"{backClr.A},{backClr.R},{backClr.G},{backClr.B}"); } else if (MainGrid.Background is ImageBrush) { AppConfig.SetAppConfig("Background", "I>" + filePath); } AppConfig.SetAppConfig("Decimal", isDecimal.ToString()); }
/// <summary> /// Serializes the font family. /// </summary> /// <param name="fontFamily">The font family.</param> /// <returns>The serialized font family.</returns> public static string SerializeFontFamily(FontFamily fontFamily) { var converter = new FontFamilyConverter(); return(converter.ConvertToString(fontFamily)); }