private void Ok(object window) { var settings = SettingsMethods.GetSettings(); settings.Accepted = Accepted; File.WriteAllText(Constants.SettingsFilePath, JsonConvert.SerializeObject(settings)); var accept = (AcceptWindow)window; accept.Close(); }
private void InitializeWpfApplicationSettings() { if (System.Windows.Application.Current == null) { new System.Windows.Application(); } if (System.Windows.Application.Current != null) { System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; var controlsResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml", UriKind.Absolute) }; var colorsResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml", UriKind.Absolute) }; var fontsResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml", UriKind.Absolute) }; var greenResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/Green.xaml", UriKind.Absolute) }; var baseLightResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml", UriKind.Absolute) }; var flatButtonsResources = new ResourceDictionary { Source = new Uri("pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml", UriKind.Absolute) }; //System.Windows.Application.Current.Resources.MergedDictionaries.Add(fontsResources); System.Windows.Application.Current.Resources.MergedDictionaries.Add(colorsResources); System.Windows.Application.Current.Resources.MergedDictionaries.Add(greenResources); System.Windows.Application.Current.Resources.MergedDictionaries.Add(baseLightResources); System.Windows.Application.Current.Resources.MergedDictionaries.Add(flatButtonsResources); System.Windows.Application.Current.Resources.MergedDictionaries.Add(controlsResources); } //create settings folder if (!Directory.Exists(Constants.SettingsFolderPath)) { Directory.CreateDirectory(Constants.SettingsFolderPath); } var settings = SettingsMethods.GetSettings(); if (!settings.AlreadyAddedDefaultRules) { AddDefaultRules(settings); } }
private void InitializeWpfApplicationSettings() { if (System.Windows.Application.Current == null) { new System.Windows.Application(); } if (System.Windows.Application.Current != null) { System.Windows.Application.Current.ShutdownMode = ShutdownMode.OnExplicitShutdown; } //create settings folder if (!Directory.Exists(Constants.SettingsFolderPath)) { Directory.CreateDirectory(Constants.SettingsFolderPath); } var settings = SettingsMethods.GetSettings(); if (!settings.AlreadyAddedDefaultRules) { AddDefaultRules(settings); } }