private void btnLoginInfo_Click(object sender, EventArgs e) { if (!DataHolder.HasLoginInfo) { string name = txtLoginName.Text; string password = txtLoginPassword.Text; DataHolder.SetLoginInfo(new LoginInfo(name, password)); } else { DataHolder.DeleteLoginInfo(); } }
private static void Main() { Data.CheckStartupFolders(); PluginLoader.LoadPlugins(); if (File.Exists(Data.logininfo)) { DataHolder.SetLoginInfo(LoginInfo.Load(Data.logininfo)); } DataHolder.SetBackups(BackupLoader.LoadBackups()); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); BackupLoader.SaveBackups(DataHolder.GetBackups()); if (DataHolder.HasLoginInfo) { DataHolder.GetLoginInfo().Save(Data.logininfo); } else { File.Delete(Data.logininfo); } }
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(); }