static void Main() { bool flag = false; mutex = new System.Threading.Mutex(true, "MyChat", out flag); if (!flag) { MessageBox.Show("当前程序已启动", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Application.ThreadException += Application_ThreadException; System.AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; System.Threading.Tasks.Task.Run(() => { Sysconstant.AutoStart(true, Application.ExecutablePath); }); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new FormMain()); }
void checkBox1_CheckedChanged(object sender, EventArgs e) { //throw new NotImplementedException(); Sysconstant.AutoStart(this.checkBox1.Checked, Application.ExecutablePath, true); }