public void DisplaySetAutoStartForm() { try { SetAutoStartForm frm = new SetAutoStartForm(); if (frm.ShowDialog() == DialogResult.OK) { Logger.info("환경설정 변경"); } frm.Dispose(); } catch (Exception ex) { Logger.error(ex.ToString()); } }
private void Mn_default_Click(object sender, EventArgs e) { try { string autostart = System.Configuration.ConfigurationSettings.AppSettings["autostart"]; string topmost = System.Configuration.ConfigurationSettings.AppSettings["topmost"]; if (configform != null) { configform.Close(); } configform = new SetAutoStartForm(); configform.pbx_confirm.MouseClick += new MouseEventHandler(pbx_confirm_MouseClick); if (autostart.Equals("1")) { configform.cbx_autostart.Checked = true; } if (topmost.Equals("1")) { configform.cbx_topmost.Checked = true; } if (nopop == true) { configform.cbx_nopop.Checked = true; } if (nopop_outbound == true) { configform.cbx_nopop_outbound.Checked = true; } configform.ShowDialog(); } catch (Exception ex) { logWrite(ex.ToString()); } }
private void pbx_confirm_MouseClick(object sender, MouseEventArgs e) { try { if (configform.cbx_autostart.CheckState == CheckState.Checked) { //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "autostart", "1"); setConfigXml(AppConfigFullPath, "autostart", "1"); System.Configuration.ConfigurationSettings.AppSettings.Set("autostart", "1"); //RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(CommonDef.REG_CUR_USR_RUN, true); //rkApp.SetValue("WeDo", Application.ExecutablePath.ToString()); rkApp.SetValue(AppRegName, Application.ExecutablePath.ToString()); rkApp.Close(); } else { //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "autostart", "0"); setConfigXml(AppConfigFullPath, "autostart", "0"); System.Configuration.ConfigurationSettings.AppSettings.Set("autostart", "0"); //RegistryKey rkApp = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); RegistryKey rkApp = Registry.CurrentUser.OpenSubKey(CommonDef.REG_CUR_USR_RUN, true); if (rkApp.GetValue(AppRegName) != null) { rkApp.DeleteValue(AppRegName); } rkApp.Close(); } if (configform.cbx_topmost.CheckState == CheckState.Checked) { this.TopMost = true; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "topmost", "1"); setConfigXml(AppConfigFullPath, "topmost", "1"); System.Configuration.ConfigurationSettings.AppSettings.Set("topmost", "1"); } else { this.TopMost = false; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "topmost", "0"); setConfigXml(AppConfigFullPath, "topmost", "0"); System.Configuration.ConfigurationSettings.AppSettings.Set("topmost", "0"); } if (configform.cbx_nopop.CheckState == CheckState.Checked) { this.nopop = true; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "nopop", "1"); setConfigXml(AppConfigFullPath, "nopop", "1"); System.Configuration.ConfigurationSettings.AppSettings.Set("nopop", "1"); } else { this.nopop = false; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "nopop", "0"); setConfigXml(AppConfigFullPath, "nopop", "0"); System.Configuration.ConfigurationSettings.AppSettings.Set("nopop", "0"); } if (configform.cbx_nopop_outbound.CheckState == CheckState.Checked) { this.nopop_outbound = true; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "nopop_outbound", "1"); setConfigXml(AppConfigFullPath, "nopop_outbound", "1"); System.Configuration.ConfigurationSettings.AppSettings.Set("nopop_outbound", "1"); } else { this.nopop_outbound = false; //setConfigXml(Application.StartupPath + "\\WDMsg_Client_Demo.exe.config", "nopop_outbound", "0"); setConfigXml(AppConfigFullPath, "nopop_outbound", "0"); System.Configuration.ConfigurationSettings.AppSettings.Set("nopop_outbound", "0"); } configform.Close(); configform = null; } catch (Exception ex) { logWrite(ex.ToString()); } }