/// <summary> /// Remove observer listener from this transport /// </summary> /// <param name="observer"></param> public void Unsubscribe(CloverTransportObserver observer) { if (observer != null && observers.Contains(observer)) { observers.Remove(observer); } }
public void Subscribe(CloverTransportObserver observer) { CloverTransport me = this; if (ready) { BackgroundWorker bw = new BackgroundWorker(); // what to do in the background thread bw.DoWork += new DoWorkEventHandler( delegate (object o, DoWorkEventArgs args) { BackgroundWorker b = o as BackgroundWorker; observer.onDeviceReady(me); }); bw.RunWorkerAsync(); } observers.Add(observer); }
/// <summary> /// Add observer listener to this transport /// </summary> /// <param name="observer"></param> public void Subscribe(CloverTransportObserver observer) { if (observer != null && !observers.Contains(observer)) { CloverTransport me = this; if (ready) { BackgroundWorker bw = new BackgroundWorker(); // what to do in the background thread bw.DoWork += delegate { observer.onDeviceReady(me); }; bw.RunWorkerAsync(); } observers.Add(observer); } }
public void Subscribe(CloverTransportObserver observer) { CloverTransport me = this; if (ready) { BackgroundWorker bw = new BackgroundWorker(); // what to do in the background thread bw.DoWork += new DoWorkEventHandler( delegate(object o, DoWorkEventArgs args) { BackgroundWorker b = o as BackgroundWorker; observer.onDeviceReady(me); }); bw.RunWorkerAsync(); } observers.Add(observer); }
/// <summary> /// Adds a observer for transport events to the member transport object to notify /// </summary> /// <param name="observer"></param> public void Subscribe(CloverTransportObserver observer) { this.transport.Subscribe(observer); }
/// <summary> /// Adds a observer for transport events to the member transport object to notify /// </summary> /// <param name="observer"></param> public void Subscribe(CloverTransportObserver observer) { Log(MessageLevel.Detailed, $"CloverDevice.{nameof(Subscribe)} {nameof(CloverTransportObserver)}"); transport.Subscribe(observer); }
public void Unsubscribe(CloverTransportObserver observer) { observers.Remove(observer); }