private async void AddPicture(PictureType pictureType)
        {
            VisitorPicture picture = null;

            // If picture type is big, creates a new Visitor Picture using the image to crop attribute.
            if ((pictureType == PictureType.Big) && (this.imageToCrop != null))
            {
                this.visitorPictures = new Collection <VisitorPicture>()
                {
                };

                picture = new VisitorPicture
                {
                    Content     = await storageService.FileToByte(this.imageToCrop),
                    PictureType = pictureType
                };

                this.visitorPictures.Add(picture);
            }


            // If picture type is small, creates a new Visitor Picture using the image croppped attribute.
            else if ((pictureType == PictureType.Small) && ((this.imageCropped != null)))
            {
                await dispatcherService.InvokeUI(async() =>
                {
                    picture = new VisitorPicture
                    {
                        Content     = await storageService.FileToByte(this.imageCropped),
                        PictureType = pictureType
                    };
                    this.visitorPictures.Add(picture);
                    IsBusy = true;


                    var newVisitorPictures = this.visitorPictures.ToList();

                    foreach (var visitorPicture in newVisitorPictures)
                    {
                        visitorPicture.VisitorId = visitItem.VisitorId;
                    }

                    await this.clientService.VisitorPictureService.AddOrUpdatePictures(visitorPictures);

                    var message = new VisitorPicturesChanged(this.visitorPictures);
                    this.MessengerInstance.Send <VisitorPicturesChanged>(message);

                    this.Visit.ChangePhotos(this.visitorPictures);
                    base.RaisePropertyChanged(() => Visit);
                    IsBusy = false;
                });
            }
        }
Example #2
0
 private void VisitorPictureChanged(VisitorPicturesChanged visitorPictureChanged)
 {
     OnVisitorPicturesChanged(visitorPictureChanged.Content);
 }