コード例 #1
0
        public virtual void DoWork(int hours, WorkType workType)
        {
            for (int i = 0; i < hours; i++)
            {
                for (int j = 0; j < 100000; j++)
                {
                    ;
                }

                var e = new WorkPerformedEventArgs
                {
                    Hours    = i + 1,
                    WorkType = workType
                };
                OnWorkPerformed(this, e);
            }

            OnWorkComplete(this, EventArgs.Empty);
        }
コード例 #2
0
 protected virtual void OnWorkPerformed(object sender, WorkPerformedEventArgs e)
 {
     WorkPerformed?.Invoke(sender, e);
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: Speak91/Nordic-it-netcore
 private static void OnWorkerWorkPerformed(object sender, WorkPerformedEventArgs e)
 {
     Console.WriteLine($"Work of type '{e.WorkType}' performed for about {e.Hours} hours.");
 }