示例#1
0
 public RecognitionPresenter(ILiveView view)
 {
     _view = view;
     _view.VideoStreamStarting += new EventHandler <RecognitionEventArgs>(OnVideoStreamStarting);
     _view.CloseButtonClicked  += new EventHandler(OnProgramClosing);
     _view.BackButtonClicked   += new EventHandler(OnBackButtonClicked);
 }
示例#2
0
        public LiveViewHost(ILiveView view, Action <string> logger)
        {
            _logger          = logger;
            _sourceWatcher   = new LiveSourceWatcher(logger);
            _assemblyWatcher = new LiveFileWatcher(logger);
            _assemblyPath    = view.GetType().Assembly.Location;

            var loader = new LiveControlLoader(logger);

            _subscription = _assemblyWatcher
                            .FileChanged
                            .ObserveOn(AvaloniaScheduler.Instance)
                            .Select(path => loader.LoadControl(path, this))
                            .Subscribe(control => Content = control);

            AppDomain.CurrentDomain.ProcessExit += (sender, args) =>
            {
                Dispose();
                Process.GetCurrentProcess().Kill();
            };

            Console.CancelKeyPress += (sender, args) =>
            {
                Dispose();
                Process.GetCurrentProcess().Kill();
            };
        }
示例#3
0
        public LiveViewHost(ILiveView view, Action <string> logger)
        {
            _logger          = logger;
            _sourceWatcher   = new LiveSourceWatcher(logger);
            _assemblyWatcher = new LiveFileWatcher(logger);
            _assemblyPath    = view.GetType().Assembly.Location;

            var loader = new LiveControlLoader(logger);

            _subscription = _assemblyWatcher
                            .FileChanged
                            .ObserveOn(AvaloniaScheduler.Instance)
                            .Subscribe(path => loader.LoadControl(path, this));

            Console.CancelKeyPress += (sender, args) => Clean("Console Ctrl+C key press.", false);
            AppDomain.CurrentDomain.ProcessExit        += (sender, args) => Clean("Process termination.", false);
            AppDomain.CurrentDomain.UnhandledException += (sender, args) => Clean(args.ExceptionObject.ToString(), true);
        }