Example #1
0
 private void btnTakePicture_Click(object sender, RoutedEventArgs e)
 {
     stopCamera();
     CropDialog.Show(_hostDialog.Parent, frameImage.Source, delegate(CropDialog.CloseEvent closeEvent, Uri file)
     {
         if (closeEvent == CropDialog.CloseEvent.Saved)
         {
             triggerSavedImage(file);
             close();
             _hostDialog.Close();
         }
         else
         {
             startCamera();
         }
     });
 }
Example #2
0
        public static void Show(Panel parent, ImageSource picture, closeHandler handler)
        {
            CropDialog cropDialog = new CropDialog();

            cropDialog.frameImage.Source = picture;
            cropDialog.onSavedImage     += handler;

            new Dialog(parent, cropDialog, false, true, false, null,
                       new DialogButton("Forget", DialogButton.Alignment.Right, DialogButton.Style.Flat, delegate() {
                cropDialog.forget();

                return(DialogButton.ReturnEvent.Close);
            }), new DialogButton("Save", DialogButton.Alignment.Right, DialogButton.Style.Normal, delegate() {
                cropDialog.cropAndSaveImage();

                return(DialogButton.ReturnEvent.Close);
            }));
        }
Example #3
0
        public static void Show(Panel parent, ImageSource picture, closeHandler handler)
        {
            CropDialog cropDialog = new CropDialog();
            cropDialog.frameImage.Source = picture;
            cropDialog.onSavedImage += handler;

            new Dialog(parent, cropDialog, false, true, false, null,
                new DialogButton("Forget", DialogButton.Alignment.Right, DialogButton.Style.Flat, delegate () {

                    cropDialog.forget();

                    return DialogButton.ReturnEvent.Close;
                }), new DialogButton("Save", DialogButton.Alignment.Right, DialogButton.Style.Normal, delegate () {

                    cropDialog.cropAndSaveImage();

                    return DialogButton.ReturnEvent.Close;
                }));
        }
Example #4
0
        public static void Show(Panel parent, savedImageHandler onSavedImage)
        {
            CameraDialog cameraDialog = new CameraDialog();

            cameraDialog.onSavedImage += onSavedImage;

            cameraDialog._hostDialog = new Dialog(parent, cameraDialog, true, true, false, null,
                                                  new DialogButton("Close Camera", DialogButton.Alignment.Right, DialogButton.Style.Flat, delegate()
            {
                cameraDialog.close();

                return(DialogButton.ReturnEvent.Close);
            }), new DialogButton("Import Image", DialogButton.Alignment.Left, DialogButton.Style.Flat, delegate()
            {
                Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
                dlg.DefaultExt         = ".png";
                dlg.Filter             = "Image Files (*.jpeg,*.jpg,*.png,*.gif)|*.jpeg;*.jpg;*.png;*.gif";
                Nullable <bool> result = dlg.ShowDialog();
                if (result == true)
                {
                    string filename = dlg.FileName;
                    cameraDialog.stopCamera();
                    CropDialog.Show(cameraDialog._hostDialog.Parent, new BitmapImage(new Uri(filename)), delegate(CropDialog.CloseEvent closeEvent, Uri file)
                    {
                        if (closeEvent == CropDialog.CloseEvent.Saved)
                        {
                            cameraDialog.triggerSavedImage(file);
                            cameraDialog.close();
                            cameraDialog._hostDialog.Close();
                        }
                        else
                        {
                            cameraDialog.startCamera();
                        }
                    });
                }

                return(DialogButton.ReturnEvent.DoNothing);
            }));
        }