private void ButtonScanPort_Click(object sender, EventArgs e) { PanelConnection.Focus(); if (LabelStatus.Text == "Status : Connected") { MessageBox.Show("Conncetion in progress, please Disconnect to scan the new port.", MessageBoxButtons.OK.ToString()); return; } ComboBoxPort.Items.Clear(); Array myPort; int i; myPort = System.IO.Ports.SerialPort.GetPortNames(); ComboBoxPort.Items.AddRange((object[])myPort); i = ComboBoxPort.Items.Count; i = i - i; try { ComboBoxPort.SelectedIndex = i; ButtonConnect.Enabled = true; } catch (Exception ex) { MessageBox.Show("Com port not detected", ex.Message); ComboBoxPort.Text = ""; ComboBoxPort.Items.Clear(); return; } ComboBoxPort.DroppedDown = true; }
private void Form1_Load(object sender, EventArgs e) { this.CenterToScreen(); PanelConnection.Focus(); CircularProgressBarHumidity.Value = 0; ComboBoxBaudRate.SelectedIndex = 0; for (int i = 0; i <= 30; i += 1) { Chart1.Series["Humidity "].Points.AddY(0); if (Chart1.Series[0].Points.Count == ChartLimit) { Chart1.Series[0].Points.RemoveAt(0); } Chart2.Series["Temperature"].Points.AddY(0); if (Chart2.Series[0].Points.Count == ChartLimit) { Chart2.Series[0].Points.RemoveAt(0); } } Chart1.ChartAreas[0].AxisY.Maximum = 180; Chart1.ChartAreas[0].AxisY.Minimum = -20; Chart1.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false; Chart2.ChartAreas[0].AxisY.Maximum = 70; Chart2.ChartAreas[0].AxisY.Minimum = -30; Chart2.ChartAreas["ChartArea1"].AxisX.LabelStyle.Enabled = false; PictureBoxPBTemp.Height = 0; }
private void ButtonDisconnect_Click(object sender, EventArgs e) { PanelConnection.Focus(); TimerSerial.Stop(); SerialPort1.Close(); ButtonDisconnect.SendToBack(); ButtonConnect.BringToFront(); LabelStatus.Text = "Status : Disconnect"; PictureBoxStatusConnection.Visible = true; PictureBoxStatusConnection.BackColor = Color.Red; }
private void BreakConnectionItem_Click(object sender, RoutedEventArgs e) { Console.WriteLine("Bye bye"); PanelConnection connection = (sender as MenuItem).Tag as PanelConnection; connection.Delete(); Connections.Remove(connection); Statement first = (connection.First as GStatement).GetBoundProperty() as Statement; Statement second = (connection.Second as GStatement).GetBoundProperty() as Statement; first.NextStatements.Remove(second); }
public GraphicalConversationEditor(Conversation conversation, GCEPresentation presentation) { InitializeComponent(); this.conversation = conversation; Connections = new List <PanelConnection>(); PanelConnection.SetWorkspace(Workspace); GCEPresentation.Workspace = Workspace; LoadPresentation(presentation); ScrollViewer.ScrollToVerticalOffset(Workspace.Height / 2); ScrollViewer.ScrollToHorizontalOffset(Workspace.Width / 2); WelcomeText.Visibility = Visibility.Collapsed; UpdateStartStatementsSequence(); }
private void ButtonConnect_Click(object sender, EventArgs e) { PanelConnection.Focus(); try { SerialPort1.BaudRate = Convert.ToInt32(ComboBoxBaudRate.SelectedItem); SerialPort1.PortName = ComboBoxPort.SelectedItem.ToString(); SerialPort1.Open(); TimerSerial.Start(); LabelStatus.Text = "Status : Connected"; ButtonConnect.SendToBack(); ButtonDisconnect.BringToFront(); PictureBoxStatusConnection.BackColor = Color.Green; } catch (Exception ex) { MessageBox.Show("Please check the Hardware, COM, Baud Rate and try again.", ex.Message); } }
// -------- Start -------- public GraphicalConversationEditor(Conversation conversation = null) { InitializeComponent(); if (conversation == null) { this.conversation = new Conversation("test", 1906); Project.Quest.Conversations.Add(conversation); } else { this.conversation = conversation; } ScrollViewer.ScrollToVerticalOffset(Workspace.Height / 2); ScrollViewer.ScrollToHorizontalOffset(Workspace.Width / 2); PanelConnection.SetWorkspace(Workspace); Connections = new List <PanelConnection>(); }
// ---- public void InvokeWorkspace() { PanelConnection.SetWorkspace(Workspace); }
private void Control_Connection_MouseDown(object sender, MouseButtonEventArgs e) { if (!creatingConnection || selected == null) { return; } Control connecting = sender as Control; IPanel selectedPanel = sender as IPanel; IPanel connectingPanel = connecting as IPanel; PanelConnection panelConnection = null; if (connecting is GStatement) { GStatement connectingGStatement = connecting as GStatement; panelConnection = new PanelConnection(selected, connecting, true, BreakConnectionItem_Click); if (selected.StatementType == connectingGStatement.StatementType) { Console.WriteLine("Cannot connect two statements with same type!"); creatingConnection = false; selected = null; return; } (selected.GetBoundProperty() as Statement).NextStatements.Add(connectingGStatement.GetBoundProperty() as Statement); } else if (connecting is GProperty) { GProperty connectingGProperty = connecting as GProperty; if (connectingGProperty.GetBoundProperty() == null) { Console.WriteLine("GProperty property is not defined!"); creatingConnection = false; selected = null; return; } panelConnection = new PanelConnection(selected, connecting, false, BreakConnectionItem_Click); Statement statement = selected.GetBoundProperty() as Statement; Property property = connectingGProperty.GetBoundProperty() as Property; if (connectingGProperty.Type == PropertyType.Condition) { statement.Conditions.Add(property); if (connectingGProperty.Negated) { statement.NegatedConditions.Add(property.ID); } } else if (connectingGProperty.Type == PropertyType.Event) { statement.Events.Add(property); } } Connections.Add(panelConnection); creatingConnection = false; selected = null; HideTopInformationBar(); }
private void ComboBoxPort_DropDown_1(object sender, EventArgs e) { PanelConnection.Focus(); }
private void ComboBoxBaudRate_SelectedIndexChanged(object sender, EventArgs e) { PanelConnection.Focus(); }