public MainForm() { InitializeComponent(); InitTexts(); try { List <string> args = Environment.GetCommandLineArgs().ToList(); setupFlowLayoutPanel.Visible = (args[1] == "SETUPMODE"); } catch { setupFlowLayoutPanel.Visible = false; } Text = TextsParams.ParameterName(0); serialPort.LoadSettingsFromFile("Comset.xml"); CreateChildForms(); systemConfiguration.LoadFromFile("SysType.xml"); InitSystemConfig(); EnableAllButtons(false); serialPort.PortClosed += new EventHandler(serialPort_PortClosed); serialPort.SerialPortError += new EventHandler(serialPort_SerialPortError); serialPort.FatalSerialPortError += new EventHandler(serialPort_FatalSerialPortError); }
//************************УСТАНОВКА ТЕКУЩЕГО ВРЕМЕНИ *********************************************// //************************************************************************************************// private void setClockBtn_Click(object sender, EventArgs e) { if (MessageBox.Show(TextsParams.ParameterName(18), "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { DateTime dt = DateTime.Now; TimeConfig.SendSetTimeRequest(serialPort, systemConfiguration.TimeConfig, dt.Hour, dt.Minute, dt.Second, dt.Day, dt.Month, dt.Year - 2000); } }
void CreateChildForms() { loadScopeForm = new LoadScopeForm(AppTexts, serialPort); directAccessForm = new DirectAccessForm(serialPort, AppTexts); jogForm = new JogForm(serialPort, AppTexts); angleForm = new AngleForm(serialPort, AppTexts); downloadSYMForm = new DownloadSYMForm(serialPort, AppTexts); floatDirectAccess = new FloatDirectAccessForm(serialPort, TextsParams.GetListParamNames(4, 14)); eventLogForm = new EventLogForm(AppTexts, serialPort, systemConfiguration); verificationForm = new VerificationForm(serialPort); }
//************************УСТАНОВКА-РАЗРЫВ СОЕДИНЕНИЯ *********************************************// //************************************************************************************************// private void connectBtn_Click(object sender, EventArgs e) { try { serialPort.Open(); } catch { ErrorMessage(TextsParams.ParameterName(15)); return; } if (serialPort.IsOpen) { EnableAllButtons(true); } else { ErrorMessage(TextsParams.ParameterName(15)); } }
//************************СОЗДАНИЕ ФОРМЫ**********************************************************// //*****************************************8******************************************************// void InitTexts() { try { toolTip1.SetToolTip(connectBtn, TextsParams.ParameterName(2)); toolTip1.SetToolTip(disconnectBtn, TextsParams.ParameterName(3)); toolTip1.SetToolTip(setClockBtn, TextsParams.ParameterName(19)); toolTip1.SetToolTip(loadSysTypeBtn, TextsParams.ParameterName(20)); directBtn.Title = TextsParams.ParameterName(45); directFloatBtn.Title = TextsParams.ParameterName(4); toolTip1.SetToolTip(directFloatBtn, TextsParams.ParameterName(4)); loadSYMBtn.Title = TextsParams.ParameterName(17); scopeLabelButton.Title = TextsParams.ParameterName(70); eventLabelButton.Title = TextsParams.ParameterName(99); jogLabelButton.Title = TextsParams.ParameterName(111); angleLabelButton.Title = TextsParams.ParameterName(119); digitTitle.Text = TextsParams.ParameterName(108); verificationlabelButton.Title = TextsParams.ParameterName(111); } catch (Exception e) { } }
private void comSetBtn_Click(object sender, EventArgs e) { ComSetForm comSet = new ComSetForm(serialPort, TextsParams.GetListParamNames(29, 38)); comSet.ShowDialog(); }