public void refreshTheme(MesCaller mesCaller) { try { Process.Start(ConstantsAndVars.themePaths); } catch (Exception ex) { mesCaller(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Thread.Sleep(ConstantsAndVars.DelayThemeUpdate * 1000); Registry.SetValue(ConstantsAndVars.registryThemeCommandPath, ConstantsAndVars.registryThemeCommands[0], 0); Registry.SetValue(ConstantsAndVars.registryThemeCommandPath, ConstantsAndVars.registryThemeCommands[1], 0); Thread.Sleep(ConstantsAndVars.DelaySettingClose * 1000); try { Thread.Sleep(700); var proc = System.Diagnostics.Process.GetProcessesByName("SystemSettings"); foreach (Process procs in proc) { procs.Kill(); } } catch (Exception ex) { mesCaller(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Form1_Loads(object sender, EventArgs e) { textBoxPath.Text = constantsAndVars.themePath(); constantsAndVars.SetterDelaysStart(); toggleAuto.Checked = bool.TryParse(ConstantsAndVars.ini.ReadINI(ConstantsAndVars.settingCol[0], ConstantsAndVars.settingCol[4]), out var result) ? result : false; numUD1.Value = ConstantsAndVars.DelayBeforeStart; изменитьНастройкиToolStripMenuItem.Text = NotifyMessages.notifyIconToolText; numUD2.Value = ConstantsAndVars.DelayThemeUpdate; numUD3.Value = ConstantsAndVars.DelaySettingClose; labelVersion.Text = NotifyMessages.versionS + " " + Application.ProductVersion; numUD4.Value = ConstantsAndVars.DelayProgramClose; if (toggleAuto.Checked) { if (ConstantsAndVars.themePaths != null) { this.WindowState = FormWindowState.Minimized; notifyIcon1.Visible = true; MesCaller mesCaller = MessageBoxCaller; var proc = new Thread(() => { themeRef.refThemeAuto(mesCaller); }); proc.IsBackground = true; proc.Start(); } } var proc1 = new Thread(() => { AutoUpdateChecher(); }); proc1.Start(); }
// private void MetroButton1_Click(object sender, EventArgs e) { MesCaller mesCaller = MessageBoxCaller; var proc = new Thread(() => { themeRef.refreshTheme(mesCaller); }); proc.Start(); // proc.Join(); }
public void refThemeAuto(MesCaller mesCaller) { refreshTheme(mesCaller); Thread.Sleep(ConstantsAndVars.DelayProgramClose * 1000); Application.Exit(); }