Exemple #1
0
 private void APIHandler_CameraAdded(CanonAPI sender)
 {
     try { Dispatcher.Invoke((Action) delegate { RefreshCamera(); }); }
     catch (Exception ex) { Report.Error(ex.Message, false); }
 }
Exemple #2
0
 private void ErrorHandler_SevereErrorHappened(object sender, Exception ex)
 {
     Report.Error(ex.Message, true);
 }
Exemple #3
0
        public void MakePhoto(object sender, EventArgs e)
        {
            try
            {
                photoNumberInTemplate++;
                photosInTemplate++;
                // MainCamera.TakePhotoAsync();
                Debug.WriteLine("taking a shot");
                MainCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.Halfway);
                Debug.WriteLine("halfway");
                MainCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.Completely_NonAF);
                Debug.WriteLine("completely_nonaf");
                MainCamera.SendCommand(CameraCommand.PressShutterButton, (int)ShutterButton.OFF);
                Debug.WriteLine("Finished taking a shot");

                betweenPhotos.Stop();
                secondCounter.Stop();

                PhotoTextBox.Visibility = Visibility.Hidden;

                timeLeftCopy = timeLeft;


                Debug.WriteLine("photo number in template: " + photoNumberInTemplate);
                Debug.WriteLine("photos in template: " + photosInTemplate);
                Debug.WriteLine("photo number: " + photoNumber);
            }

            catch (Exception ex) { Report.Error(ex.Message, false); }
            // TODO: zamiast sleppa jakas metoda ktora sprawdza czy zdjecie juz sie zrobilio i potem kolejna linia kodu-


            Thread.Sleep(2000);
            //jak mam sleep 4000 to mi nie dziala


            PhotoTextBox.Visibility = Visibility.Visible;
            PhotoTextBox.Text       = "Prepare for next Photo!";

            // Waiting for photo saving
            while (PhotoTaken == false)
            {
                Thread.Sleep(1000);
            }
            ShowPhotoThumbnail();
            PhotoTaken = false;

            // One if than switch
            switch (templateName)
            {
            case "foreground_1":
                if (Control.photoTemplate(photosInTemplate, 1))
                {
                    var printdata = new SavePrints(printNumber);
                    printPath = printdata.PrintDirectory;
                    LayTemplate.foreground1(printPath);
                    printNumber++;
                    PrintMenu();
                }
                break;

            case "foreground_3":
                if (Control.photoTemplate(photosInTemplate, 3))
                {
                    var printdata = new SavePrints(printNumber);
                    printPath = printdata.PrintDirectory;
                    LayTemplate.foreground3(printPath);
                    printNumber++;
                    PrintMenu();
                }
                break;

            case "foreground_4":
                if (Control.photoTemplate(photosInTemplate, 4))
                {
                    var printdata = new SavePrints(printNumber);
                    printPath = printdata.PrintDirectory;
                    LayTemplate.foreground4(printPath);
                    printNumber++;
                    PrintMenu();
                }
                break;

            case "foreground_4_paski":
                if (Control.photoTemplate(photosInTemplate, 4))
                {
                    var printdata = new SavePrints(printNumber);
                    printPath = printdata.PrintDirectory;
                    LayTemplate.foreground4stripes(printPath);
                    printNumber++;
                    PrintMenu();
                }
                break;

            default:
                Debug.WriteLine("bug at switch which template");
                break;
            }
        }