public static void Mimimize()
 {
     if (SingletonWindow != null)
     {
         if (SingletonWindow.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
         {
             SingletonWindow.Dispatcher.Invoke(new Action(() =>
             {
                 CameraClickAndMove.Mimimize();
             }));
             return;
         }
         SingletonWindow.WindowState         = WindowState.Minimized;
         SingletonWindow.Data.ButtonsVisible = Visibility.Collapsed;
     }
 }
 public static void Display(HardwareController hwc)
 {
     ScriptID = 0;
     if (HWC == null && hwc == null)
     {
         MessageBox.Show("Error while displaying Camera Window!");
         return;
     }
     if (SingletonWindow == null)
     {
         if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
         {
             TrackedThread tt = new TrackedThread("Inner Thread,CameraClickAndMove.Display ", () =>
             {
                 SingletonWindow = new CameraClickAndMove(hwc);
                 SingletonWindow.ShowDialog();
             });
             tt.ApartmentState = ApartmentState.STA;
             tt.Start(true);
             return;
         }
         SingletonWindow = new CameraClickAndMove(hwc);
         SingletonWindow.Show();
     }
     else
     {
         if (SingletonWindow.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
         {
             SingletonWindow.Dispatcher.Invoke(new Action(() =>
             {
                 CameraClickAndMove.Display(HWC);
             }));
             return;
         }
         SingletonWindow.WindowState   = SingletonWindow.PreviousWindowState;
         SingletonWindow.ShowInTaskbar = true;
     }
     SingletonWindow.Data.ButtonsVisible = Visibility.Collapsed;
 }
 private void ManuallyBtn_Click(object sender, RoutedEventArgs e)
 {
     CameraClickAndMove.Mimimize();
 }
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     //Console.WriteLine("Huhu");
     ImgThread.Abort();
     SingletonWindow = null;
 }
 private void Window_Closing(object sender, CancelEventArgs e)
 {
     //Console.WriteLine("Huhu");
     ImgThread.Abort();
     SingletonWindow = null;
 }
 public static void Display(HardwareController hwc)
 {
     ScriptID = 0;
     if (HWC == null && hwc == null)
     {
         MessageBox.Show("Error while displaying Camera Window!");
         return;
     }
     if (SingletonWindow == null)
     {
         if (System.Threading.Thread.CurrentThread.GetApartmentState() != ApartmentState.STA)
         {
             TrackedThread tt = new TrackedThread("Inner Thread,CameraClickAndMove.Display ", () =>
             {
                 SingletonWindow = new CameraClickAndMove(hwc);
                 SingletonWindow.ShowDialog();
             });
             tt.ApartmentState = ApartmentState.STA;
             tt.Start(true);
             return;
         }
         SingletonWindow = new CameraClickAndMove(hwc);
         SingletonWindow.Show();
     }
     else
     {
         if (SingletonWindow.Dispatcher.Thread != System.Threading.Thread.CurrentThread)
         {
             SingletonWindow.Dispatcher.Invoke(new Action(() =>
             {
                 CameraClickAndMove.Display(HWC);
             }));
             return;
         }
         SingletonWindow.WindowState = SingletonWindow.PreviousWindowState;
         SingletonWindow.ShowInTaskbar = true;
     }
     SingletonWindow.Data.ButtonsVisible = Visibility.Collapsed;
 }