protected override void OnCalculationPerformed(CalculationEventArgs args) { // perform custom logic here // call the base method base.OnCalculationPerformed(args); }
private void OnCalculationPerformed(CalculationEventArgs args) { // make a copy of the event EventHandler <CalculationEventArgs> handler = CalculationPerformedEvent; // check to see we have subscribers if (handler != null) { handler(this, args); } }
static void HandleEvent(object sender, CalculationEventArgs e) { Console.WriteLine("Good Class: {0} x {1} = {2}", e.X, e.Y, e.Result); }
public void HandleNotifyCalculation(object sender, CalculationEventArgs e) { // print out the details of the real calculation Console.WriteLine("NefariousClass: {0} x {1} = {2}", e.X, e.Y, e.Result); }
private void CalculationCompleted(object sender, CalculationEventArgs args) { Assert.That(sender, Is.SameAs(_worker), "The sender should be the instance that invoked the event."); _receivedEventArgs.Add(args); }
private void CalculationCompleted(object sender, CalculationEventArgs args) { _receivedEventArgs.Add(args); }
public void OnCalc(object sender, CalculationEventArgs calculationEventArgs) { { Console.WriteLine("The result of your calculation is: " + calculationEventArgs.Calculation.GetResult() + "\n"); } }