private void lstConfigs_SelectedIndexChanged(object sender, EventArgs e) { if (lstConfigs.SelectedItem != null) { Dictionary <string, object> map = MapConfig(DataHolder.GetConfig(lstConfigs.SelectedItem.ToString())); propertyGrid1.SelectedObject = new DictionaryPropertyGridAdapter <string, object>(map); } }
private void button1_Click(object sender, EventArgs e) { DictionaryPropertyGridAdapter <string, object> data = propertyGrid1.SelectedObject as DictionaryPropertyGridAdapter <string, object>; if (data != null) { Dictionary <string, object> mapped = data.GetDictionary(); Dictionary <string, Tuple <Config.Type, object> > unmapped = ReverseConfigMap(mapped); DataHolder.GetConfig(lstConfigs.SelectedItem.ToString()).SetAll(unmapped); } }
private static void Main() { //Init windows visuals Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //Init data & load plugins Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); DataHolder.LoadConfigs(); DataHolder.LoadImages(); //Check for updates if (!DataHolder.GetConfig().Has("autoupdate")) { DataHolder.GetConfig().Set("autoupdate", Plugin_API.Config.Type.Bool, false); } if ((bool)DataHolder.GetConfig().Get("autoupdate")) { Thread updateThread = new Thread(() => { Data.CheckForUpdate(); DataHolder.UpdatePlugins(); Data.PreformUpdate(); if (Data.updateData.ToString() != "") { DialogResult r = MessageBox.Show("New Update Available! Download?", "Update", MessageBoxButtons.YesNo); if (r == DialogResult.Yes) { Process.Start(Data.updaterExe); Thread.Sleep(100); Application.Exit(); } } }); updateThread.Start(); } if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); //try //{ DataHolder.mainWindow = new MainWindow(); Application.Run(DataHolder.mainWindow); DataHolder.StopPlugins(); //} //catch (Exception ex) //{ // ErrorPage ep = new ErrorPage(ex.ToString()); // Application.Run(ep); //} BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { if (File.Exists(Data.logininfo)) { File.Delete(Data.logininfo); } } DataHolder.SaveConfigs(); }