private void InitDetector() { Controller.Processor = Controller.Pipeline.VideoProcessor = Processor = new MotionProcessor(); Processor.ShadeRadius = (int)sliderContrast.Value; Processor.Threshold = (int)sliderThreshold.Value; Controller.Quality = sliderQuality.Value / 100.0; UpdateProcessorBounds(); Application.Current.Dispatcher.Invoke(() => { sliderQuality.IsEnabled = true; }); }
public MainWindow() { InitializeComponent(); Processor = new MotionProcessor(); Controller = new VideoPlayerController() { btnBrowse = btnBrowse, btnPlayPause = btnPlayPause, btnStepFrame = btnStepFrame, btnSave = btnSaveActivity, btnStop = btnStop, Canvas = videoCanvas, lblTime = lblTime, lblFPS = lblFPS, sliderTime = sliderTime, txtFileName = txtFileName, Quality = sliderQuality.Value / 100, }; Controller.OnFinishSetupPlayer += OnFinishSetupPlayer; Controller.OnOpen += OnOpen; Controller.OnReset += InitDetector; Controller.OnStartPlaying += OnStartPlaying; Controller.OnProcessed += OnProcessed; Controller.OnRefreshMostRecentFrame += OnRefreshMostRecentFrame; Controller.OnAfterStopped += OnAfterStopped; Controller.Init(); ToggleCompare(); Loaded += (sender, args) => UpdateProcessorBounds(); Closing += (sender, args) => Controller.Stop(); Application.Current.Exit += (sender, args) => Controller.Stop(); #if !DEBUG AppDomain.CurrentDomain.UnhandledException += (sender, args) => { MessageBox.Show((args.ExceptionObject as Exception).Message); }; #endif }