示例#1
0
文件: Program.cs 项目: sindab/HA4IoT
        public static void Main()
        {
            Console.Title = "Trace Viewer - HA4IoT";
            Console.WriteLine(@"  _   _    _   _  _  ___    _____   _____                    __     ___                        
 | | | |  / \ | || ||_ _|__|_   _| |_   _| __ __ _  ___ ___  \ \   / (_) _____      _____ _ __ 
 | |_| | / _ \| || |_| |/ _ \| |     | || '__/ _` |/ __/ _ \  \ \ / /| |/ _ \ \ /\ / / _ \ '__|
 |  _  |/ ___ \__   _| | (_) | |     | || | | (_| | (_|  __/   \ V / | |  __/\ V  V /  __/ |   
 |_| |_/_/   \_\ |_||___\___/|_|     |_||_|  \__,_|\___\___|    \_/  |_|\___| \_/\_/ \___|_|   
                                                                                               ");

            WriteLine("Ensure that you opened UDP port 19227 at your firewall.", ConsoleColor.White, ConsoleColor.Red);
            Console.Write("Starting... ");

            PrepareLogging();
            TraceItemReceiver.TraceItemReceived += PrintTraceItem;
            TraceItemReceiver.Start();

            Console.WriteLine("[OK]");
            Console.WriteLine("- Press 'C' to clear the console");
            Console.WriteLine("- Press 'D' to delete the log file (if logging activated)");
            Console.WriteLine("- Press 'Q' to quit");

            ConsoleKeyInfo pressedKey;

            do
            {
                pressedKey = Console.ReadKey(true);
                if (pressedKey.Key == ConsoleKey.C)
                {
                    lock (SyncRoot)
                    {
                        Console.Clear();
                    }
                }
                else if (pressedKey.Key == ConsoleKey.D)
                {
                    lock (SyncRoot)
                    {
                        if (_loggingIsEnabled)
                        {
                            File.Delete(Settings.Default.LogFilename);
                            Console.WriteLine($"Log file '{Settings.Default.LogFilename}' deleted");
                        }
                    }
                }
            } while (pressedKey.Key != ConsoleKey.Q);
        }
示例#2
0
        public static void Main()
        {
            Console.Title = "Trace Viewer - HA4IoT";

            Console.Write("Starting... ");

            PrepareLogging();
            TraceItemReceiver.TraceItemReceived += PrintTraceItem;
            TraceItemReceiver.Start();

            Console.WriteLine("[OK]");
            Console.WriteLine("- Press 'C' to clear the console");
            Console.WriteLine("- Press 'D' to delete the log file (if logging activated)");
            Console.WriteLine("- Press 'Q' to quit");

            ConsoleKeyInfo pressedKey;

            do
            {
                pressedKey = Console.ReadKey(true);
                if (pressedKey.Key == ConsoleKey.C)
                {
                    lock (SyncRoot)
                    {
                        Console.Clear();
                    }
                }
                else if (pressedKey.Key == ConsoleKey.D)
                {
                    lock (SyncRoot)
                    {
                        if (_loggingIsEnabled)
                        {
                            File.Delete(Settings.Default.LogFilename);
                            Console.WriteLine($"Log file '{Settings.Default.LogFilename}' deleted");
                        }
                    }
                }
            } while (pressedKey.Key != ConsoleKey.Q);
        }
示例#3
0
        public HealthTabVM(ControllerClient controllerClient)
        {
            if (controllerClient == null)
            {
                throw new ArgumentNullException(nameof(controllerClient));
            }

            TraceItems = new SelectableObservableCollection <TraceItem>();

            _controllerClient = controllerClient;

            _traceItemReceiverClient = new TraceItemReceiverClient();
            _traceItemReceiverClient.TraceItemReceived += EnlistTraceItem;
            _traceItemReceiverClient.Start();

            ClearCommand = new DelegateCommand(Clear);

            AutoScroll          = new PropertyVM <bool>(true);
            ShowVerboseMessages = new PropertyVM <bool>(true);
            ShowInformations    = new PropertyVM <bool>(true);
            ShowWarnings        = new PropertyVM <bool>(true);
            ShowErrors          = new PropertyVM <bool>(true);
        }