/// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var group = AlbumDataSource.GetAlbum((string)e.NavigationParameter);

            this.DefaultViewModel["Group"] = group;
            this.DefaultViewModel["Items"] = group.Items;
        }
        /// <summary>
        /// Populates the page with content passed during navigation. Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session. The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var albums = new List <AlbumViewModel>(AlbumDataSource.GetAlbums());

            albums.Add(new AlbumViewModel(string.Empty, "<Create New Album>"));

            var uploadForm = new UploadViewModel()
            {
                Albums        = albums,
                SelectedAlbum = albums[0]
            };

            this.DefaultViewModel["Form"] = uploadForm;
        }
        private async void UploadPicture(object sender, RoutedEventArgs e)
        {
            var uploadForm = this.DefaultViewModel["Form"] as UploadViewModel;

            if (await this.IsValid(uploadForm))
            {
                progressBar.Visibility        = Visibility.Visible;
                uploadPictureButton.IsEnabled = false;
                selectPictureButton.IsEnabled = false;

                await AlbumDataSource.UploadPicture(uploadForm);

                //// Navigate to home page
                this.Frame.Navigate(typeof(GroupedPicturesPage));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Populates the page with content passed during navigation.  Any saved state is also
        /// provided when recreating a page from a prior session.
        /// </summary>
        /// <param name="sender">
        /// The source of the event; typically <see cref="NavigationHelper"/>
        /// </param>
        /// <param name="e">Event data that provides both the navigation parameter passed to
        /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
        /// a dictionary of state preserved by this page during an earlier
        /// session.  The state will be null the first time a page is visited.</param>
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            var navigationParameter = (string)e.NavigationParameter;

            // Allow saved page state to override the initial item to display
            if (e.PageState != null && e.PageState.ContainsKey("SelectedItem"))
            {
                navigationParameter = (string)e.PageState["SelectedItem"];
            }

            var item = AlbumDataSource.GetItem(navigationParameter);

            this.DefaultViewModel["Group"] = item.Group;
            this.DefaultViewModel["Items"] = item.Group.Items;
            this.flipView.SelectedItem     = item;
        }
Exemplo n.º 5
0
 private void OnImageSelected()
 {
     if (Configuration.CropImage)
     {
         Console.WriteLine("Cropping image before handing it over");
         AlbumDataSource.GetCroppedImage(croppedImage =>
         {
             ImageSelected?.Invoke(this, croppedImage);
             Dismiss();
         });
     }
     else
     {
         Console.WriteLine("Not cropping image");
         ImageSelected?.Invoke(this, _album.ImageCropView.Image);
         Dismiss();
     }
 }
Exemplo n.º 6
0
        private void DoneButtonPressed(object sender, EventArgs e)
        {
            if (AlbumDataSource.CurrentMediaType == MediaType.Image)
            {
                if (Configuration.CropImage)
                {
                    Console.WriteLine("Cropping image before handing it over");
                    AlbumDataSource.GetCroppedImage(OnImageFinished);
                }
                else
                {
                    Console.WriteLine("Not cropping image");
                    OnImageFinished(AlbumView.ImageCropView.Image);
                }
            }

            if (AlbumDataSource.CurrentMediaType == MediaType.Video)
            {
                var url = AlbumView.MoviePlayerController.ContentUrl;
                OnVideoFinished(url);
            }
        }
Exemplo n.º 7
0
        private void Delete()
        {
            var item = AlbumDataSource.DeleteCurrentMediaItem();

            Deleted?.Invoke(this, item);
        }
 /// <summary>
 /// Populates the page with content passed during navigation.  Any saved state is also
 /// provided when recreating a page from a prior session.
 /// </summary>
 /// <param name="sender">
 /// The source of the event; typically <see cref="NavigationHelper"/>
 /// </param>
 /// <param name="e">Event data that provides both the navigation parameter passed to
 /// <see cref="Frame.Navigate(Type, Object)"/> when this page was initially requested and
 /// a dictionary of state preserved by this page during an earlier
 /// session.  The state will be null the first time a page is visited.</param>
 private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
 {
     this.DefaultViewModel["Groups"] = AlbumDataSource.GetAlbums();
 }