public virtual void OnStatusChanged(IStatusChangedEventArgs inE) { if (UnitStatusChanged != null) { UnitStatusChanged(this, inE); } }
private void Builder_FactoryProgress(object sender, IStatusChangedEventArgs e) { _dataContext.ForceUpdate(); // This block is is required without an observablecollection // [[ /* * // http://dotnetpattern.com/wpf-dispatcher * // Dispatcher provides two methods for registering method to execute into the message queue. * // * // Invoke method takes an Action or Delegate and execute the method synchronously. * // * // That means it does not return until the Dispatcher complete the execution of the method. * // BeginInvoke method take a Delegate but it executes the method asynchronously. * // That means it immediately returns before calling the method. * * Dispatcher.BeginInvoke((Action)(() => * { * // INIT ? * QueueList.ItemsSource = new List<IFactoryQueueElement>(); * // REFRESH ? * QueueList.ItemsSource = _dataContext.Builder.Queue; * * // INIT ? * StorageList.ItemsSource = new List<ITestingUnit>(); * // REFRESH ? * StorageList.ItemsSource = _dataContext.Builder.Storage; * * })); */ // ]] }
public virtual void OnStatusChanged(IStatusChangedEventArgs args) { if (this.UnitStatusChanged != null) { UnitStatusChanged(this, args); } }
/// <summary> /// see http://stackoverflow.com/questions/31787748/call-an-event-from-a-base-class (is impossible) /// </summary> /// <param name="statusChangedEventArgs"></param> public void OnStatusChanged(object sender, IStatusChangedEventArgs statusChangedEventArgs) { // https://codeblog.jonskeet.uk/2015/01/30/clean-event-handlers-invocation-with-c-6/ //UnitStatusChanged?.Invoke(sender, statusChangedEventArgs); // ou UnitStatusChanged(sender, statusChangedEventArgs); }
private static void TestingUnit_UnitStatusChanged(object sender, EventArgs e) { IStatusChangedEventArgs a = e as IStatusChangedEventArgs; ITestingUnit t; if (a.NewStatus == "BeganWorking") { Console.WriteLine($"{ DateTime.UtcNow.ToLongTimeString()} Testing unit status changed to {a.NewStatus}"); t = sender as WorkingUnit; t.WorkEnds(); } else { Console.WriteLine($"{ DateTime.UtcNow.ToLongTimeString()} Testing unit status changed to {a.NewStatus}"); } }
public virtual void OnStatusChanged(IStatusChangedEventArgs scea) { EventHandler <IStatusChangedEventArgs> handler = UnitStatusChanged; // Event will be null if there are no subscribers if (handler != null) { // Format the string to send inside the CustomEventArgs parameter //scea.NewStatus += String.Format(" at {0}", DateTime.Now.ToString()); Console.Write("Now we " + scea.NewStatus); // Use the () operator to raise the event. handler(this, scea); } /* * UnitStatusChanged.Invoke(this,(StatusChangedEventArgs) scea); * Console.Write("Now we " + scea.NewStatus); */ }
public void OnStatusChanged(IStatusChangedEventArgs e) { UnitStatusChanged?.Invoke(this, (StatusChangedEventArgs)e); }
private void _ibot_UnitStatusChanged(object sender, IStatusChangedEventArgs e) { Reports.Add(((IStatusChangedEventArgs)e).NewStatus); }
protected virtual void OnStatusChanged(IStatusChangedEventArgs args) { UnitStatusChanged?.Invoke(this, (StatusChangedEventArgs)args); }
public void OnStatusChanged(object sender, IStatusChangedEventArgs args) { UnitStatusChanged?.Invoke(sender, (StatusChangedEventArgs)args); }
public void OnStatusChanged(IStatusChangedEventArgs e) { FactoryStatus?.Invoke(this, (StatusChangedEventArgs)e); }