Inheritance: Interactive
Example #1
0
 /// <summary>
 /// Create a new instance of the DreamCheeky class
 /// </summary>
 /// <param name="lidClosed">The event handler to call if the lid is closed</param>
 /// <param name="lidOpen">The event handler to call if the lid is opened</param>
 /// <param name="buttonPressed">The event handler to call if the button is pressed</param>
 public DreamCheeky(EventHandler lidClosed, EventHandler lidOpen, EventHandler buttonPressed)
 {
     _bigRedButton = new BigRedButton();
     _bigRedButton.LidClosed += lidClosed;
     _bigRedButton.LidOpen += lidOpen;
     _bigRedButton.ButtonPressed += buttonPressed;
     _bigRedButton.Start();
 }
Example #2
0
 void Start()
 {
     if (instance == null)
     {
         instance = this;
         serialPort.Open();
         serialPort.ReadTimeout = 1;
     }
     else
     {
         throw new Exception("WHAT THE F**K MATE");
     }
 }
        private static void Main(string[] args)
        {
            var button = new BigRedButton();

            System.Console.WriteLine("Listening");

            button.Listen()
                .Subscribe(state => System.Console.WriteLine(state));

            System.Console.WriteLine("Press enter to exit!");

            System.Console.ReadLine();
        }
Example #4
0
        private static void Main(string[] args)
        {
            var button = new BigRedButton();

            System.Console.WriteLine("Listening");

            button.Listen()
            .Subscribe(state => System.Console.WriteLine(state));

            System.Console.WriteLine("Press enter to exit!");

            System.Console.ReadLine();
        }
        static void Main(string[] args)
        {
            using (var redButton = new BigRedButton())
            {
                redButton.ButtonPressed += (sender, eventArgs) =>
                {
                    TryKillProcess();
                };

                redButton.Start();

                Console.ReadLine();
            }
        }
Example #6
0
        static void Main()
        {
            using (var bigRedButton = new BigRedButton())
            {
                bigRedButton.LidClosed     += (sender, args) => Console.WriteLine("Lid closed");
                bigRedButton.LidOpen       += (sender, args) => Console.WriteLine("Lid open");
                bigRedButton.ButtonPressed += (sender, args) => Console.WriteLine("Button pressed");

                bigRedButton.Start();

                Console.WriteLine("Press ENTER to exit");
                Console.ReadLine();
            }
        }
Example #7
0
        static void Main(string[] args)
        {
            using (var redButton = new BigRedButton())
            {
                redButton.ButtonPressed += (sender, eventArgs) =>
                {
                    TryKillProcess();
                };

                redButton.Start();

                Console.ReadLine();
            }
        }
Example #8
0
 /// <summary>
 /// Stop and remove the bigRedButton instance
 /// </summary>
 public void Dispose()
 {
     _bigRedButton.Stop();
     _bigRedButton = null;
 }