public void DoWork(int hours, WorkType workType) { for (int i = 0; i < hours; i++) { if (workType == WorkType.Work) { Console.WriteLine("$$$$$$$$$$$$$"); } else if (workType == WorkType.DoNothing) { Console.WriteLine("Zzzzz..."); } //WorkPerfomed WorkPerfomed?.Invoke(this, new WorkInfo(workType, hours)); } //WorkCompleted; WorkCompleted?.Invoke(this, EventArgs.Empty); //? - вызвать если не null }
protected virtual void OnWorkPerfomed(int data, WorkType workType) { WorkPerfomed?.Invoke(data, workType); }