protected void OnButtonOkClicked(object sender, EventArgs e) { //Заносим переменные из формы MainClass.tempBegin = this.tempBegin.ValueAsInt; MainClass.tempEnd = this.tempEnd.ValueAsInt; MainClass.tempStep = this.tempStep.ValueAsInt; MainClass.timeSp = this.timeSp.ValueAsInt; MainClass.timeSp1 = this.timeSp1.ValueAsInt; MainClass.entryMSD = double.Parse(this.entryMSD.Text); MainClass.comPort = this.comboPort.ActiveText; string text = this.tempBegin.ValueAsInt.ToString() + "," + this.tempEnd.ValueAsInt.ToString() + "," + this.tempStep.ValueAsInt.ToString() + "," + this.timeSp.ValueAsInt.ToString() + "," + this.timeSp1.ValueAsInt.ToString() + "," + this.entryMSD.Text + "," + this.comboPort.ActiveText; MainProgramm.WriteFileSetting(text); this.OnClose(); }
protected void OnButStartClicked(object sender, EventArgs e) { butStart.Sensitive = false; _start = new Diplom.MainProgramm(); _start.LogWriteLine += Log; _start.ShowSSt += ChartingSt; _start.WriteLabelSetting += _start_WriteLabelSetting; _start.WriteLabelTemp += _start_WriteLabelTemp; _start.WriteLabelMSD += _start_WriteLabelMSD; _start.ShowMSD += ChartingMSD; _start.ShowC += ChartingC; _start.ClearCandMSD += ChartingCandMSDClear; _start.activateButtonStart += delegate { butStart.Sensitive = true; }; _start.ShowDialog += ShowDialog; threadStart = new Thread(new ThreadStart(_start.Start)); threadStart.IsBackground = true; //теперь он фоновый и его можно закрыть по закытию программы Diplom.MainProgramm.SetFlagThread = true; threadStart.Start(); }