12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace Optimizer
- {
- public partial class MessagerForm : System.Windows.Forms.Form
- {
- MainForm _main;
- MessagerType mode;
- private void Confirm()
- {
- if (mode == MessagerType.Error)
- {
- this.Close();
- }
- if (mode == MessagerType.Optimize)
- {
- this.Hide();
- OptimizeForm f = new OptimizeForm(!chkPrint.Checked, !chkSensors.Checked);
- f.ShowDialog();
- f.BringToFront();
- }
- if (mode == MessagerType.Startup)
- {
- _main.RemoveAllStartupItems();
- }
- if (mode == MessagerType.Restart)
- {
- Optimize.RebootPC();
- }
- if (mode == MessagerType.Hosts)
- {
- _main.RemoveAllHostsEntries();
- }
- if (mode == MessagerType.Integrator)
- {
- _main.RemoveAllDesktopItems();
- }
- }
- public MessagerForm(MainForm main, MessagerType m, string s)
- {
- InitializeComponent();
- Options.ApplyTheme(this);
- _main = main;
- mode = m;
- msg.Text = s;
- if (mode == MessagerType.Error)
- {
- nobtn.Visible = false;
- yesbtn.Text = "OK";
- this.AcceptButton = nobtn;
- this.AcceptButton = yesbtn;
- this.CancelButton = nobtn;
- this.CancelButton = yesbtn;
- }
- if (mode == MessagerType.Optimize)
- {
- chkPrint.Checked = true;
- chkPrint.Visible = true;
- chkSensors.Checked = false;
- chkSensors.Visible = true;
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- private void button39_Click(object sender, EventArgs e)
- {
- Confirm();
- this.Close();
- }
- private void Restarter_Load(object sender, EventArgs e)
- {
- CheckForIllegalCrossThreadCalls = false;
- this.BringToFront();
- }
- }
- }
|