private void SignalIsChanged(object sender, SignalChangedEventArgs e) { for (int i = 0; i < ioList.Count; i++) { if (listViewMonitor.Items[i].Text == sender.ToString()) { listViewMonitor.Items[i].SubItems[1].Text = e.NewSignalState.Value.ToString(); } } }
// method to do something if IO is on or off. private void SignalChangedEven(Object sender, SignalChangedEventArgs e) { DigitalSignal digitalSig = (DigitalSignal)Sig; int val = digitalSig.Get(); if (val == 1) { Console.WriteLine(); Console.WriteLine($"Signal {Sig.Name.ToString()} is changed"); Console.WriteLine("Text message was sent."); //gmEmail = new GmailEmail(); //gmEmail.SetUpEmail(); outEmail = new OutlookEmail(); outEmail.SendThroughOUTLOOK(); } } // end of SignalChangedEven method
//为了避免界面线程和主线程冲突,采用委托方式 private void IO_OUT_StateChanged(object sender, SignalChangedEventArgs e) { this.Invoke(new EventHandler(Update_OUT_Status), sender, e); }
void OnSignalChanged (object sender, SignalChangedEventArgs args) { OnSignalChanged (args); }
void OnSignalChanged(object s, SignalChangedEventArgs args) { OnSignalChanged(args); }
void SignalChanged(object sender, SignalChangedEventArgs e) { this.Invoke(new EventHandler <SignalChangedEventArgs>(SignalIsChanged), new Object[] { sender, e }); }
internal void SignalChangedHandler(object sender, SignalChangedEventArgs e) { OnSignalChanged(e.Time + GetDelay()); }
private void OnSignalChangedEvent(object sender, SignalChangedEventArgs e) { _console.OutputEvent($"Signal changed to {e.State}."); }