Esempio n. 1
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        public static void Main()
        {
            // We shouldn't be logging to the console in a console app that is user-interactive
            Logger.UnregisterLogger <ConsoleLogger>();

            Pi.Init <BootstrapWiringPi>();

            var exit = false;

            do
            {
                Console.Clear();
                Console.CursorVisible = true;
                var mainOption = Terminal.ReadPrompt("Main options", MainOptions, "Esc to exit this program");
                Console.CursorVisible = true;

                switch (mainOption.Key)
                {
                case ConsoleKey.S:
                    SystemTests.ShowMenu();
                    break;

                case ConsoleKey.P:
                    Peripherals.Peripherals.ShowMenu();
                    break;

                case ConsoleKey.X:
                    Extra.Extra.ShowMenu();
                    break;

                case ConsoleKey.Escape:
                    exit = true;
                    break;
                }
            }while (!exit);

            Console.Clear();
            Console.CursorVisible = true;
            Console.ResetColor();
        }
Esempio n. 2
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        /// <returns>A task representing the program.</returns>
        public static async Task Main()
        {
            $"Starting program at {DateTime.Now}".Info();

            Terminal.Settings.DisplayLoggingMessageType = LogMessageType.Info | LogMessageType.Warning | LogMessageType.Error;
            Pi.Init <BootstrapWiringPi>();

            var exit = false;

            do
            {
                Console.Clear();
                var mainOption = "Main options".ReadPrompt(MainOptions, "Esc to exit this program");

                switch (mainOption.Key)
                {
                case ConsoleKey.S:
                    await SystemTests.ShowMenu().ConfigureAwait(false);

                    break;

                case ConsoleKey.P:
                    Peripherals.ShowMenu();
                    break;

                case ConsoleKey.X:
                    Extra.ShowMenu();
                    break;

                case ConsoleKey.Escape:
                    exit = true;
                    break;
                }
            }while (!exit);

            Console.Clear();
        }