Ejemplo n.º 1
0
 public ArduinoCOMEmulator_WinForm()
 {
     InitializeComponent();
     arduinocomout1 = new ArduinoCOMOut();
     arduinocomout1.COMOUTErrorOccured += arduinocomout1_COMOUTErrorOccured;
     _communicate_start = false;
 }
Ejemplo n.º 2
0
        private void arduinocomout1_COMOUTErrorOccured(Object sender, COMOUTErrorEventArgs args)
        {
            // UIとは別スレッドからの実行のため、Invokeメソッドを使ってスレッドセーフにする(通信スレッドからUIスレッドに委譲)
            // コントロールを生成したスレッドの場合 InvokeRequired は false となります。
            if (this.InvokeRequired)
            {
                // コントロールを生成したスレッドに処理を委譲します。
                this.Invoke((MethodInvoker) delegate() { arduinocomout1_COMOUTErrorOccured(sender, args); });
                return;
            }

            ArduinoCOMOut senderobj = (ArduinoCOMOut)sender;

            MessageBox.Show(args.Message, "ArduinoCOMError", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            _communicate_start = false;
            buttonStart.Text   = "Start";
        }