示例#1
0
        /// <summary>
        /// 開始揍人
        /// </summary>
        /// <param name="personName">被揍的人</param>
        public void punchSomeBody(string personName)
        {
            string            tool              = "Apple";
            int               count             = 2;
            PunchingEventArgs punchingEventArgs = new PunchingEventArgs(personName, count, tool);

            this.OnPunching?.Invoke(this, punchingEventArgs);
            if (punchingEventArgs.Cancel)
            {
                return;
            }
            System.Threading.Thread.Sleep(3000);
            PunchedEventArgs punchedEventArgs = new PunchedEventArgs(personName, count, tool);

            //if (this.Punch != null)
            //{
            //    this.Punch(this, EventArgs.Empty);
            //}
            //  ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
            this.OnPunched?.Invoke(this, punchedEventArgs);
            //打完了
        }
示例#2
0
 private static void Antony_OnPunched(object sender, PunchedEventArgs e)
 {
     Console.WriteLine("Antony 打了{1}({2}下)! @{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now, e.Name, e.Count);
 }