コード例 #1
0
ファイル: EventExample.cs プロジェクト: mindball/CSharpOOP
        public void DoWork(int hours, WorkType type)
        {
            for (int i = 0; i < hours; i++)
            {
                if (this.WorkPerformed != null)
                {
                    this.WorkPerformed.Invoke(i + 1, type);
                }
            }

            if (this.WorkComplete != null)
            {
                WorkComplete.Invoke(this, new WorkCompletedEventArgs(hours, type));
            }
        }
コード例 #2
0
 protected virtual void OnWorkComplete(object sender, EventArgs e)
 {
     WorkComplete?.Invoke(sender, e);
 }
コード例 #3
0
 /// <summary>
 /// Interprocess messege recived handler
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnIpcCommunicationMessageRecived(object sender, WorkResult e)
 {
     m_WorkCommandResults[e.Guid] = e;
     WorkComplete?.Invoke(this, new WorkCompleteEventArgs(e.Guid));
 }