public void OnAddCalculationChanged(object sender, CalculatorArgs args) { Console.WriteLine("获得了一个大于100的结果"); if (args.FirstNum < 0) { MessageSender messageSender = new MessageSender(); messageSender.OutputMesasge("输入的第一个参数小于0", EMesasgeType.Error); } }
public decimal Add(decimal firstNum, decimal secondNum) { decimal result = 0; result = firstNum + secondNum; if (result > 100) { var eventArgs = new CalculatorArgs() { FirstNum = firstNum, SecondNum = secondNum, Result = result }; OnResultChanged(this, eventArgs); } return(result); }