private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var isVisible = (bool)e.NewValue;

            if (isVisible)
            {
                CurrentDevice?.Start();
            }
            else
            {
                CurrentDevice?.SignalToStop();
            }
        }
Exemple #2
0
 public void Start()
 {
     if (CurrentDevice != null)
     {
         try
         {
             CurrentDevice.NewFrame += new NewFrameEventHandler(CameraNewFrameEventHandler);
             CurrentDevice.Start();
             IsStarted = true;
         }
         catch
         {
             MessageBox.Show($"Error opening a device called {CurrentDeviceName}", "Error", MessageBoxButton.OK);
         }
     }
 }