private void send_btn_Click(object sender, EventArgs e) { if (!is_file) { MessageBox.Show("Файл не открыт"); return; } stateCOM = COMState.Start_Upload; }
private void button1_Click(object sender, EventArgs e) { stateCOM = COMState.Write; }
private void ConnectMenu_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e) { string item = e.ClickedItem.ToString(); //ToolStripItemClickedEventArgs.ClickedItem; if (item == "Отключить" && COM.IsOpen) { COM.Close(); is_connected = false; stateForm = WorkState.Idle; // Connectbtn.Enabled = false; stateRegs = WorkState.Idle; //return; } else if (item == "Настройка") { if (!is_open) { if (COM.IsOpen) { COM.Close(); } stateRegs = WorkState.Idle; stateForm = WorkState.Idle; Form Cs = new WindowsFormsApplication1.COM_settings(); Cs.Show(); is_open = true; Csisopen = true; } } else { if (COM.IsOpen) { COM.Close(); } COM.PortName = item; try { COM.Open(); is_connected = true; stateForm = WorkState.Update; Filtr_lbl.Invoke((MethodInvoker) delegate { Filtr_lbl.Text = "Подключен"; stateCOM = COMState.Wait; }); } catch (Exception ex) { m_lastError = ex.Message; } } }