static void Main(string[] args)
        {
            Counter c = new Counter(new Random().Next(10));
            c.ThresholdReached += c_ThresholdReached;

            Console.WriteLine("Press 'a' key to increase total");
            while(Console.ReadKey(true).KeyChar == 'a')
            {
                Console.WriteLine("Adding One");
                c.Add(1);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            Counter c = new Counter(new Random().Next(10));

            c.ThresholdReached += c_ThresholdReached;

            Console.WriteLine("press 'a' key to increase total");
            while (Console.ReadKey(true).KeyChar == 'a')
            {
                Console.WriteLine("adding one");
                c.Add(1);
            }
        }
示例#3
0
        static void Main(string[] args)
        {
            Counter c = new Counter(new Random().Next(10));//get a random 0-9 number

            c.ThresholdReached += c_ThresholdReached;
            c.ThresholdReached += c_ExampleSubscriber;

            Console.WriteLine("press 'a' key to increase total"); // get user unput
            while (Console.ReadKey(true).KeyChar == 'a')          //as user presses'a', 1 is added
            {
                Console.WriteLine("adding one");                  //advise user that one was added
                c.Add(1);                                         //add 1 to the clas C ADD method
            }
        }