private void Main_Load(object sender, EventArgs e) { if (!ShowConfig) { this.WindowState = FormWindowState.Minimized; } //if (!Properties.Settings.Default.Master) //{ // NetControl.Start(); //} netID.Text = Properties.Settings.Default.NetworkID; gammaValueA.Text = Properties.Settings.Default.GammaA.ToString(); gammaValueB.Text = Properties.Settings.Default.GammaB.ToString(); WatchDog.Checked = Properties.Settings.Default.WatchDogTimer; SetMasterState(Properties.Settings.Default.Master); MasterCheckbox.Checked = Properties.Settings.Default.Master; if (!Properties.Settings.Default.Master) { NetControl.Start(); } string yourVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); this.Text += " " + yourVersion; }
void SetMasterState(bool newMasterState) { if (Properties.Settings.Default.Master != newMasterState) { if (Properties.Settings.Default.Master) { Properties.Settings.Default.Master = newMasterState; NetControl.Start(); } else { Properties.Settings.Default.Master = newMasterState; NetControl.Abort(); } } ShowMasterState(newMasterState); }