private void uninstall_Click(object sender, EventArgs e) { Readdy rd = (Readdy)this.stepPanel.Controls[0]; rd.uninstall.Click -= new EventHandler(uninstall_Click);; rd.cancel.Click -= new EventHandler(cancel_Click); bool canCreateNew; Mutex m = new Mutex(true, Settings.mutexName, out canCreateNew); if (!canCreateNew) { CloseApp ca = new CloseApp(); ca.richTextBox1.AppendText("ZLPlayer.exe"); ca.continueBtn.Click += new EventHandler(continueBtn_Click); this.stepPanel.Controls.RemoveAt(0); this.stepPanel.Controls.Add(ca); rd.Dispose(); return; } m.ReleaseMutex(); UnInstalling ui = new UnInstalling(); this.stepPanel.Controls.RemoveAt(0); this.stepPanel.Controls.Add(ui); rd.Dispose(); uninstalling = true; backgroundWorker1.RunWorkerAsync(); }
private void continueBtn_Click(object sender, EventArgs e) { CloseApp ca = (CloseApp)this.stepPanel.Controls[0]; ca.continueBtn.Enabled = false; ca.richTextBox1.Text = "Closing Program..."; semaphore = new Semaphore(0, 1); Thread thread = new Thread(ThreadFun); thread.Start(); semaphore.WaitOne(); semaphore.Close(); ca.continueBtn.Click -= new EventHandler(continueBtn_Click); UnInstalling ui = new UnInstalling(); this.stepPanel.Controls.RemoveAt(0); this.stepPanel.Controls.Add(ui); ca.Dispose(); uninstalling = true; backgroundWorker1.RunWorkerAsync(); }
private void uninstall_Click(object sender, EventArgs e) { Readdy rd = (Readdy)this.stepPanel.Controls[0]; rd.uninstall.Click -= new EventHandler(uninstall_Click); ; rd.cancel.Click -= new EventHandler(cancel_Click); bool canCreateNew; Mutex m = new Mutex(true, Settings.mutexName, out canCreateNew); if (!canCreateNew) { CloseApp ca = new CloseApp(); ca.richTextBox1.AppendText("ZLPlayer.exe"); ca.continueBtn.Click += new EventHandler(continueBtn_Click); this.stepPanel.Controls.RemoveAt(0); this.stepPanel.Controls.Add(ca); rd.Dispose(); return; } m.ReleaseMutex(); UnInstalling ui = new UnInstalling(); this.stepPanel.Controls.RemoveAt(0); this.stepPanel.Controls.Add(ui); rd.Dispose(); uninstalling = true; backgroundWorker1.RunWorkerAsync(); }