Exemple #1
0
        public void ShowPhoto(IMobeelizerFile photo)
        {
            MessagePrompt showPhoto = new MessagePrompt();

            showPhoto.ActionPopUpButtons.Clear();
            showPhoto.Body = new PhotoControl(photo);
            showPhoto.Show();
        }
Exemple #2
0
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            IMobeelizerFile file   = value as IMobeelizerFile;
            BitmapImage     bitmap = new BitmapImage();

            bitmap.CreateOptions = BitmapCreateOptions.BackgroundCreation;
            using (var stream = file.GetStream())
            {
                bitmap.SetSource(stream);
            }

            return(bitmap);
        }
Exemple #3
0
        private void GetPhotoTaskCompleted(object sender, PhotoResult e)
        {
            if (getPhotoCallback != null)
            {
                if (e.TaskResult == TaskResult.OK)
                {
                    JpegInfo info = ExifReader.ReadJpeg(e.ChosenPhoto, e.OriginalFileName);
                    e.ChosenPhoto.Seek(0, SeekOrigin.Begin);
                    ExifOrientation _orientation = info.Orientation;
                    int             _angle       = 0;
                    switch (info.Orientation)
                    {
                    case ExifOrientation.TopLeft:
                    case ExifOrientation.Undefined:
                        _angle = 0;
                        break;

                    case ExifOrientation.TopRight:
                        _angle = 90;
                        break;

                    case ExifOrientation.BottomRight:
                        _angle = 180;
                        break;

                    case ExifOrientation.BottomLeft:
                        _angle = 270;
                        break;
                    }

                    Stream capturedImage;
                    if (_angle > 0d)
                    {
                        capturedImage = RotateStream(e.ChosenPhoto, _angle);
                    }
                    else
                    {
                        capturedImage = e.ChosenPhoto;
                    }
                    IMobeelizerFile file = Mobeelizer.CreateFile("photo", capturedImage);
                    this.getPhotoCallback(file);
                    this.getPhotoCallback = null;
                }
                else
                {
                    this.GetPhoto(getPhotoCallback);
                }
            }
        }
 /// <summary>
 /// Generates json entity from file instance.
 /// </summary>
 /// <param name="value">File instance.</param>
 /// <returns>Json entity string value.</returns>
 protected String SetFile(IMobeelizerFile value)
 {
     return (value as MobeelizerFile).GetJson();
 }
Exemple #5
0
 /// <summary>
 /// Generates json entity from file instance.
 /// </summary>
 /// <param name="value">File instance.</param>
 /// <returns>Json entity string value.</returns>
 protected String SetFile(IMobeelizerFile value)
 {
     return((value as MobeelizerFile).GetJson());
 }
 public void ShowPhoto(IMobeelizerFile photo)
 {
     MessagePrompt showPhoto = new MessagePrompt();
     showPhoto.ActionPopUpButtons.Clear();
     showPhoto.Body = new PhotoControl(photo);
     showPhoto.Show();
 }
 public PhotoControl(IMobeelizerFile photo)
 {
     InitializeComponent();
     this.photo = photo;
     this.DataContext = this;
 }
Exemple #8
0
 public PhotoControl(IMobeelizerFile photo)
 {
     InitializeComponent();
     this.photo       = photo;
     this.DataContext = this;
 }