protected void OnAction(object sender, ActionCancelEventArgs ev) { if (Action != null) Action(sender, ev); }
private void DoAction(object sender, ActionCancelEventArgs ev) { ev.Cancel = !DoActions(); if (ev.Cancel) ev.Message = "Bad time"; }
public void Click() { var cancelEvent = new ActionCancelEventArgs(); OnAction(this, cancelEvent); if(cancelEvent.Cancel) Console.WriteLine(cancelEvent.Message); else Console.WriteLine(_busEntity.TimeString); }