Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        public void Button1_Clicked()
        {
            this.Button1.Enabled = false;
            this.Button2.Enabled = true;

            this.Button1.setLabel("start @ " + MyComputation.Current.Value);
            this.Button2.setLabel("Stop computing");

            MyComputation.Start();
        }