public void WriteSetting(SettingStyle style) { Horoscope.Properties.Settings ps = Horoscope.Properties.Settings.Default; ps.CurrentZodiac = currentZodiac; var converter = new BrushConverter(); ps.Background = converter.ConvertToString(border.Background); ps.WindowOrasity = gridOpacity.Opacity; ps.FontSize = WindowMain.FontSize; ps.FontName = WindowMain.FontFamily.Source; ps.FontOpacity = presentDay.Foreground.Opacity; ps.Foreground = converter.ConvertToString(presentDay.Foreground); if (WindowMain.FontStyle == FontStyles.Normal) { ps.FontStyle = "Normal"; } if (WindowMain.FontStyle == FontStyles.Italic) { ps.FontStyle = "Italic"; } if (WindowMain.FontWeight == FontWeights.Normal) { ps.FontWeight = "Normal"; } if (WindowMain.FontWeight == FontWeights.Bold) { ps.FontWeight = "Bold"; } }
public Setting(MainWindow k) { InitializeComponent(); _showMainWindow = k; cyrrentStyle = _showMainWindow.styleWindow; autoStart_CheckBox.IsChecked = ps.Autorun; checkBox_Copy.IsChecked = ps.FormFixed; comboBox.ItemsSource = _showMainWindow.zodiacListRu.Values; comboBox.SelectedValue = _showMainWindow.zodiacListRu[ps.CurrentZodiac]; }
public void ApplySetting(SettingStyle style) { tabControl.Width = ps.Width; tabControl.Height = ps.Height; border.Background.Opacity = ps.Opacity ? 0 : 100; currentZodiac = ps.CurrentZodiac; border.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ps.Background)); gridOpacity.Opacity = ps.WindowOrasity; WindowMain.FontSize = ps.FontSize; WindowMain.FontFamily = (System.Windows.Media.FontFamily) new FontFamilyConverter().ConvertFromString(ps.FontName); presentDay.Foreground.Opacity = ps.FontOpacity; tomorrow.Foreground.Opacity = ps.FontOpacity; week.Foreground.Opacity = ps.FontOpacity; var colorText = new SolidColorBrush((Color)ColorConverter.ConvertFromString(ps.Foreground)); presentDay.Foreground = colorText; tomorrow.Foreground = colorText; week.Foreground = colorText; if (ps.FontStyle == "Normal") { WindowMain.FontStyle = FontStyles.Normal; } if (ps.FontStyle == "Italic") { WindowMain.FontStyle = FontStyles.Italic; } if (ps.FontWeight == "Normal") { WindowMain.FontWeight = FontWeights.Normal; } if (ps.FontWeight == "Bold") { WindowMain.FontWeight = FontWeights.Bold; } }