예제 #1
0
        private static void Main(string[] args)
        {
            _startColor = Console.ForegroundColor;
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                _handler      = ConsoleCtrlCheck;
                _processEvent = Program_Exited;

                SetConsoleCtrlHandler(_handler, true);
                Process.GetCurrentProcess().Exited += _processEvent;
                string url = args.Length != 1 ? InputBox.GetUrl() : args[0];
                LogSuccess(url);
                if (string.IsNullOrEmpty(url))
                {
                    LogError("No RTSPsource url specified");
                    return;
                }
                bool restart = true;
                while (restart)
                {
                    using (_dlg = new VideoStatus())
                    {
                        _dlg.LoadUrl(url);
                        Application.Run(_dlg);
                    }
                    Thread.Sleep(5000);
                    restart = ViewModel.Get().AutoRestart;
                }
            }
            catch (Exception ex)
            {
                LogError("Error: " + ex.Message);
                LogError("-------------------------------");
                LogError("Program Terminating");
            }
            finally
            {
                Console.ForegroundColor = _startColor;
            }
            if (_dlg != null && !_dlg.IsDisposed)
            {
                _dlg.Dispose();
            }

            LogError("Program ended");
        }
예제 #2
0
        private static void Main(string[] args)
        {
            _startColor = Console.ForegroundColor;
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                _handler = ConsoleCtrlCheck;
                _processEvent = Program_Exited;

                SetConsoleCtrlHandler(_handler, true);
                Process.GetCurrentProcess().Exited += _processEvent;
                string url = args.Length != 1 ? InputBox.GetUrl() : args[0];
                LogSuccess(url);
                if (string.IsNullOrEmpty(url))
                {
                    LogError("No RTSPsource url specified");
                    return;
                }
                bool restart = true;
                while (restart)
                {
                    using (_dlg = new VideoStatus())
                    {
                        _dlg.LoadUrl(url);
                        Application.Run(_dlg);
                    }
                    Thread.Sleep(5000);
                    restart = ViewModel.Get().AutoRestart;
                }
            }
            catch (Exception ex)
            {
                LogError("Error: " + ex.Message);
                LogError("-------------------------------");
                LogError("Program Terminating");
            }
            finally
            {
                Console.ForegroundColor = _startColor;
            }
            if (_dlg != null && !_dlg.IsDisposed)
                _dlg.Dispose();

            LogError("Program ended");
        }