public void UpdateSettings(DBCSettings newSettings)
        {
            DBCSettings = newSettings;
            JsonSerializer ser = new() { TypeNameHandling = TypeNameHandling.Auto };

            using (StreamWriter file = File.CreateText(@"dbc.json"))
            {
                ser.Serialize(file, DBCSettings);
            }
        }
    }
        public void UpdateSettings(DBCSettings newSettings)
        {
            DBCSettings = newSettings;
            JsonSerializer ser = new JsonSerializer()
            {
                TypeNameHandling = TypeNameHandling.Auto
            };

            using (StreamWriter file = File.CreateText(@"dbc.json"))
            {
                ser.Serialize(file, DBCSettings);
            }
            System.Windows.MessageBox.Show("Restart the application.");
        }
        public DbcSettingsProvider()
        {
            if (File.Exists("dbc.json"))
            {
                JsonSerializer ser = new() { TypeNameHandling = TypeNameHandling.Auto };
                using (StreamReader re = new("dbc.json"))
                {
                    JsonTextReader reader = new(re);
                    DBCSettings = ser.Deserialize <DBCSettings>(reader);
                }
            }

            if (DBCSettings == null)
            {
                DBCSettings = new DBCSettings();
            }
        }
        public void OnInitialized(IContainerProvider containerProvider)
        {
            if (File.Exists("dbc.json"))
            {
                JsonSerializer ser = new Newtonsoft.Json.JsonSerializer()
                {
                    TypeNameHandling = TypeNameHandling.Auto
                };
                using (StreamReader re = new StreamReader("dbc.json"))
                {
                    JsonTextReader reader = new JsonTextReader(re);
                    DBCSettings = ser.Deserialize <DBCSettings>(reader);
                }
            }
            else
            {
                DBCSettings = new DBCSettings();
            }

            store.Load();
        }
 public void UpdateSettings(DBCSettings newSettings)
 {
     DBCSettings = newSettings;
     userSettings.Update(DBCSettings);
 }