Example #1
0
        public void WorkCallout(object state)
        {
            OnWorkDoneEventArgs args = new OnWorkDoneEventArgs();

            args.Time = (int)state;
            OnFinishedWork?.Invoke(this, args);
        }
Example #2
0
        /// <summary>
        /// This method simulates work.
        /// </summary>
        public void Work()
        {
            Random rnd = new Random();

            Console.WriteLine($"Doing work... Thread: {Thread.CurrentThread.ManagedThreadId}");
            int intensity = 5000 + rnd.Next(1000, 9000);

            Thread.Sleep(intensity);
            OnWorkDoneEventArgs args = new OnWorkDoneEventArgs();

            args.Time = intensity;
            OnFinishedWork?.Invoke(this, args);
        }