예제 #1
0
        private void ConnectToolBarButton_Click(object sender, RoutedEventArgs e)
        {
            COMPortInfoModel comPortInfo = COMPortInfoListView.SelectedCOMItem;

            if (comPortInfo != null)
            {
                ArduinoSerialPort.Open(comPortInfo.COMPort);

                if (ArduinoSerialPort.IsOpen)
                {
                    ConnectToolBarButton.IsEnabled     = false;
                    ConnectToolBarButton.Visibility    = Visibility.Collapsed;
                    RunToolBarButton.IsEnabled         = true;
                    DisconnectToolBarButton.Visibility = Visibility.Visible;
                    DisconnectToolBarButton.IsEnabled  = true;

                    ManualControlView.IsEnabled = true;
                }
            }
        }
예제 #2
0
        private void RunToolBarButton_Click(object sender, RoutedEventArgs e)
        {
            COMPortInfoModel comPortInfo = COMPortInfoListView.SelectedCOMItem;

            if (comPortInfo != null)
            {
                //ArduinoSerialPort.Open(comPortInfo.COMPort);

                ArduinoSerialPort.Path = new Path((PathEditor.DataContext as PathEditorViewModel).StepList);
                ArduinoSerialPort.SendNextStep();


                StopToolBarButton.IsEnabled = true;
                RunToolBarButton.IsEnabled  = false;

                ManualControlView.IsEnabled = false;

                //List<Step> steps = (PathEditor.DataContext as PathEditorViewModel).StepList;
                //JSONCommand jsonCommand = new JSONCommand(new Path(steps));
                //ArduinoSerialPort.Send(jsonCommand);
            }
        }
 private void PortComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     SelectedCOMItem = PortComboBox.SelectedItem as COMPortInfoModel;
     // COMPortInfoModel comPortInfo = (COMPortInfoModel)(PortComboBox.SelectedItem);
     //RunToolBarButton.IsEnabled = comPortInfo != null && comPortInfo.DeviceName.Contains("Arduino");
 }