public static void Main(string[] args) { Console.WriteLine("This example will show how to write multithreaded console."); var MyComputation = new LongComputation(); StopwatchDelegate GotTime = e => { Console.WriteLine("time: " + e.TotalMilliseconds + "ms"); }; GotTime.Measure( delegate { MyComputation.Start(); Console.WriteLine(); Console.WriteLine("Press enter to stop current computation."); Console.ReadLine(); MyComputation.Stop(); Console.WriteLine("Value: " + MyComputation.Current.Value); } ); Console.WriteLine(); Console.WriteLine("Press enter to exit."); Console.ReadLine(); }
public void Button2_Clicked() { this.Button1.Enabled = true; this.Button2.Enabled = false; MyComputation.Stop(); this.Button1.setLabel("Start computing"); this.Button2.setLabel("stop @ " + MyComputation.Current.Value); }