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();
        }
Exemple #2
0
 public GRBL09(Connection machineConnection)
     : base(machineConnection)
 {
     MachineConnection.LineReceived += MachineConnection_LineReceived;
 }