コード例 #1
0
        private void machineConnect(Connection c)
        {
            try
            {
                c.Connect();

                machineBtnDisconnect.Content = $"Disconnect {c.Path}";

                switch (machine_comBoxFirmware.SelectedIndex)
                {
                    case 0:
                        MachineInterface = new GRBL09(c);
                        break;
                    default:
                        throw new Exception("The selected Firmware is not yet supported");
                }

                MachineInterface.StatusReceived += delegate { Dispatcher.Invoke(UpdateStatusStrip); };
                MachineInterface.Disconnected += DisconnectCleanup;
                MachineInterface.ErrorReceived += (error) => { MessageBox.Show(error); };

                MachineTimer.Interval = PositionPollRates[Settings.Default.PositionPollRateIndex];

                MachineTimer.Start();
            }
            catch (Exception ex)
            {
                DisconnectCleanup();
                MessageBox.Show($"Could not connect: {ex.Message}");
            }

            UpdateUi();
        }
コード例 #2
0
ファイル: GRBL09.cs プロジェクト: martin2250/CNCTool
 public GRBL09(Connection machineConnection)
     : base(machineConnection)
 {
     MachineConnection.LineReceived += MachineConnection_LineReceived;
 }