private void btnShow_Click(object sender, RoutedEventArgs e) { try { ArduinoCommands temp = new ArduinoCommands(); temp = (ArduinoCommands)listCommands.SelectedItem; MessageBox.Show(temp.ToStringDetailed()); } catch (Exception) { MessageBox.Show("No command was selected"); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { if (tbNewCmdTitle.Text != "" && tbNewCmd.Text != "") { ArduinoCommands newCmd = new ArduinoCommands(); newCmd.Title = tbNewCmdTitle.Text; newCmd.Command = tbNewCmd.Text; ArdCmds.Add(newCmd); listCommands.ItemsSource = ArdCmds; SerializeCommands(ArdCmds); tbNewCmd.Clear(); tbNewCmdTitle.Clear(); } }
private void btnSend_Click(object sender, RoutedEventArgs e) { ArduinoCommands tempCmd = new ArduinoCommands(); tempCmd = (ArduinoCommands)listCommands.SelectedItem; bool verify; verify = SerialPort1.Send(tempCmd.Command); if (verify) { lblStatus.Content = "Command sent to Arduino"; } else { lblStatus.Content = "Could not send command"; } }