/// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        /// <param name="grabber">The grabber.</param>
        /// <param name="mainViewModel">The main view model.</param>
        public MainWindow(IVideoGrabber grabber, MainViewModel mainViewModel)
        {
            this.InitializeComponent();

            this.grabber       = grabber;
            this.mainViewModel = mainViewModel;
            this.DataContext   = this.mainViewModel;

            this.Loaded += this.MainWindow_Loaded;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MainViewModel"/> class.
 /// </summary>
 /// <param name="videoGrabber">The video grabber.</param>
 /// <param name="minDelayBetweenAnalysis">The minimum delay between two analysis steps.</param>
 /// <param name="imageAnalyzers">The image analyzers.</param>
 /// <exception cref="System.ArgumentNullException">The video grabber instance must be set.</exception>
 public MainViewModel(
     IVideoGrabber videoGrabber,
     TimeSpan minDelayBetweenAnalysis,
     params IImageAnalyzer[] imageAnalyzers)
 {
     this.videoGrabber            = videoGrabber ?? throw new ArgumentNullException(nameof(videoGrabber));
     this.minDelayBetweenAnalysis = minDelayBetweenAnalysis;
     this.imageAnalyzers          = imageAnalyzers;
     this.RegionTags = new ObservableCollection <RegionTagViewModel>();
     this.Statistics = imageAnalyzers.ToDictionary(a => a, a => new AnalyzerStatisticsViewModel()
     {
         CostsPerRequest = a.CostsPerRequest,
         Count           = 0,
         Name            = a.GetType().Name,
     });
 }