public DefilinkEmulator_WinForm() { InitializeComponent(); deficomout1 = new DefiComOUT(); deficomout1.COMOUTErrorOccured += deficomout1_COMOUTErrorOccured; _communicate_start = false; }
private void deficomout1_COMOUTErrorOccured(Object sender, COMOUTErrorEventArgs args) { // UIとは別スレッドからの実行のため、Invokeメソッドを使ってスレッドセーフにする(通信スレッドからUIスレッドに委譲) // コントロールを生成したスレッドの場合 InvokeRequired は false となります。 if (this.InvokeRequired) { // コントロールを生成したスレッドに処理を委譲します。 this.Invoke((MethodInvoker) delegate() { deficomout1_COMOUTErrorOccured(sender, args); }); return; } DefiComOUT senderobj = (DefiComOUT)sender; MessageBox.Show(args.Message, "DefiCOMError", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); _communicate_start = false; buttonStart.Text = "Start"; }
public DefilinkEmulatorForm() { InitializeComponent(); deficomout1 = new DefiComOUT(); _communicate_start = false; }