Example #1
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            try
            {
                // Load the gallery info
                if (GalleryViewModel.Gallery == null || GalleryViewModel.Gallery.Count == 0 || (e.NavigationParameter as string) != GalleryViewModel.Gallery?.Link)
                {
                    this.GalleryViewModel = new GalleryViewModel();

                    this.GalleryViewModel.Gallery = await ExGallery.DownloadGalleryAsync(e.NavigationParameter as string, 1, 3);
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #2
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            try
            {
                if (GalleryViewModel.Gallery == null || GalleryViewModel.Gallery.Count == 0 || (e.NavigationParameter as string) != GalleryViewModel.Gallery?.Link)
                {
                    this.GalleryViewModel.Gallery = await ExGallery.DownloadGalleryAsync(e.NavigationParameter as string, 1, 3);


                    var f = new ImageWallRows <ExGalleryImageListItem>();
                    f.ItemsSource = this.GalleryViewModel.Gallery;
                    this.GalleryViewModel.GalleryImages = f;
                    //GalleryWall.DataContext = f;
                }
            }
            catch (Exception ex)
            {
                var x = ex.GetType();
            }
        }
Example #3
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // Load Images
            try
            {
                readyForConnectedAnimation = false;
                var galleryLinkFromLastPage = QueryString.Parse(e.NavigationParameter as string)["link"];

                // Get ExGallery
                if (App.Current.Resources.ContainsKey("Gallery"))
                {
                    this.ReadingViewModel = new ReadingViewModel(App.Current.Resources["Gallery"] as ExGallery);
                }
                else
                {
                    this.ReadingViewModel = new ReadingViewModel(await ExGallery.DownloadGalleryAsync(galleryLinkFromLastPage, 1, 3));
                }
                this.ReadingViewModel.CurrentImageIndex = -1;
                flipView.SelectedIndex = -1;

                // Jump to Page
                indexFromLastPage = int.Parse(QueryString.Parse(e.NavigationParameter as string)["page"]);

                if (this.ReadingViewModel.CurrentImageIndex != indexFromLastPage)
                {
                    readyForConnectedAnimation = true;
                    this.ReadingViewModel.CurrentImageIndex = indexFromLastPage;
                }
                else
                {
                    // Handle the connected animation
                    flipView.UpdateLayout();
                    HandleConnectedAnimation();
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #4
0
        private async void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // Load Images
            try
            {
                var galleryLinkFromLastPage = QueryString.Parse(e.NavigationParameter as string)["link"];

                // Get ExGallery
                if (App.Current.Resources.ContainsKey("Gallery"))
                {
                    this.ReadingViewModel.Gallery = App.Current.Resources["Gallery"] as ExGallery;
                }
                else
                {
                    this.ReadingViewModel.Gallery = await ExGallery.DownloadGalleryAsync(galleryLinkFromLastPage, 1, 3);
                }

                // Load all image item
                var images = new ObservableCollection <ExImage>();
                await this.ReadingViewModel.Gallery.LoadAllItemsAsync();

                foreach (var item in this.ReadingViewModel.Gallery)
                {
                    images.Add(new ExImage()
                    {
                        Link = item.Link, Thumb = item.Thumb
                    });
                }
                this.ReadingViewModel.Images = images;

                // Jump to Page
                var indexFromLastPage = int.Parse(QueryString.Parse(e.NavigationParameter as string)["page"]);
                this.ReadingViewModel.CurrentImageIndex = indexFromLastPage;
            }
            catch (Exception ex)
            {
            }
        }