Esempio n. 1
0
 public virtual void OnStatusChanged(IStatusChangedEventArgs inE)
 {
     if (UnitStatusChanged != null)
     {
         UnitStatusChanged(this, inE);
     }
 }
Esempio n. 2
0
        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;
             *
             * }));
             */
            // ]]
        }
Esempio n. 3
0
 public virtual void OnStatusChanged(IStatusChangedEventArgs args)
 {
     if (this.UnitStatusChanged != null)
     {
         UnitStatusChanged(this, args);
     }
 }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        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);
             */
        }
Esempio n. 7
0
 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);
 }
Esempio n. 11
0
 public void OnStatusChanged(IStatusChangedEventArgs e)
 {
     FactoryStatus?.Invoke(this, (StatusChangedEventArgs)e);
 }