Exemplo n.º 1
0
        private async Task HideReader()
        {
            if (Data.ShowReader)
            {
                _wasNew = await Data.SaveReaderData(_wasNew);

                if (Service.Platform.AnimationsEnabled)
                {
                    await FadeOut.StartAsync(ScrollViewer);
                }
                else
                {
                    ScrollViewer.SetVisualOpacity(0);
                }
            }
            else
            {
                if (Service.Platform.AnimationsEnabled)
                {
                    await ImagesGrid.FadeOutAsync();
                }
                else
                {
                    ImagesGrid.SetVisualOpacity(0);
                }
            }
        }
Exemplo n.º 2
0
        private void CommandBar_Loaded(object sender, RoutedEventArgs e)
        {
            AppBarButtons.Clear();

            foreach (Models.Site site in Models.Site.Load())
            {
                AppBarButton appBarButton = new AppBarButton()
                {
                    Label = site.Name,
                    Tag   = site.Url,
                    Icon  = (site.Url == App.Settings.GetSite()?.Url) ? new SymbolIcon(Symbol.Accept) : null
                };

                appBarButton.Click += (_s, _e) =>
                {
                    App.Settings.current_site     = site.Url;
                    App.Settings.current_tag_code = null;
                    //Images.ClearSelf();
                    ImagesGrid.Reset();
                    HistoryOfTags.ChaneCurrentTag();
                };
                MainCommandBar.SecondaryCommands.Add(appBarButton);
                AppBarButtons.Add(appBarButton);
            }
        }
Exemplo n.º 3
0
 private void ScrollViewer_ViewChanged(object sender, ScrollViewerViewChangedEventArgs e)
 {
     //System.Diagnostics.Debug.WriteLine("ImagesScrollViewer.VerticalOffset - ((Frame)Window.Current.Content).ActualHeight:" + (ImagesScrollViewer.ScrollableHeight - ((Frame)Window.Current.Content).ActualHeight));
     //System.Diagnostics.Debug.WriteLine("VerticalOffset:" + ImagesScrollViewer.VerticalOffset);
     //System.Diagnostics.Debug.WriteLine("ScrollableHeight:" + ImagesScrollViewer.ScrollableHeight);
     //if (ImagesScrollViewer.VerticalOffset == ImagesScrollViewer.ScrollableHeight)
     //{
     ImagesGrid.CheckVisible(ImagesScrollViewer.VerticalOffset);
     //}
 }
Exemplo n.º 4
0
        private async Task ShowReader(int page = 0)
        {
            if (Data.ShowReader)
            {
                var readerSet = Data.ArchiveImagesReader.FirstOrDefault(s => s.Page >= page);
                if (readerSet == null)
                {
                    return;
                }
                var index = Data.ArchiveImagesReader.IndexOf(readerSet);
                Data.ReaderIndex = index;

                if (Data.UseVerticalReader)
                {
                    await Task.Delay(100);

                    var element = ReaderVertical.GetOrCreateElement(index);
                    element.UpdateLayout();
                    element.StartBringIntoView(new BringIntoViewOptions {
                        AnimationDesired = false, VerticalAlignmentRatio = 0f
                    });
                }
                else
                {
                    await ChangePage();
                }

                if (Service.Platform.AnimationsEnabled)
                {
                    await FadeIn.StartAsync(ScrollViewer);
                }
                else
                {
                    ScrollViewer.SetVisualOpacity(1);
                }
                FocusReader();
            }
            else
            {
                if (Service.Platform.AnimationsEnabled)
                {
                    await ImagesGrid.FadeInAsync();
                }
                else
                {
                    ImagesGrid.SetVisualOpacity(1);
                }
            }
        }
Exemplo n.º 5
0
        private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            if (App.Settings.max_side_size == -1)
            {
                if ((Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Desktop"))
                {
                    App.Settings.max_side_size = 230;
                }
                else
                {
                    App.Settings.max_side_size = 100;
                }
            }

            double width = Window.Current.Bounds.Width;

            App.Settings.images_in_row = (int)(width / App.Settings.max_side_size);
            App.Settings.side_size     = (int)(width / App.Settings.images_in_row) - 4;

            ImagesGrid.OnSizeChanged();
        }
Exemplo n.º 6
0
        private void OpenTag_Click(object sender, RoutedEventArgs e)
        {
            HidePanels();
            System.Diagnostics.Debug.WriteLine("menuTag.Code:" + menuTag.Code + ":");
            System.Diagnostics.Debug.WriteLine("menuTag.SiteUrl:" + menuTag.SiteUrl + ":");
            if (menuTag.Code == "")
            {
                App.Settings.current_tag_code = null;
                SearchButton.Background       = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));
            }
            else
            {
                HistoryOfTags.AddTag(menuTag);
                App.Settings.current_site     = menuTag.SiteUrl;
                App.Settings.current_tag_code = menuTag.Code;
                SearchButton.Background       = (SolidColorBrush)Resources["SystemControlBackgroundAccentBrush"];
            }

            ImagesGrid.Reset();
            menuTag = null;
            HistoryOfTags.ChaneCurrentTag();
        }
Exemplo n.º 7
0
        private async void OpenReader(int page, object item = null)
        {
            if (_transition)
            {
                return;
            }
            _transition = true;
            var readerSet = Data.ArchiveImagesReader.FirstOrDefault(s => s.Page >= page);

            if (readerSet == null)
            {
                return;
            }
            var index = Data.ArchiveImagesReader.IndexOf(readerSet);

            if (Service.Platform.AnimationsEnabled && item != null && !Data.UseVerticalReader)
            {
                var image = ImagesGrid.ContainerFromItem(item).FindDescendant("Thumbnail");
                if (!(image.ActualWidth == 0 || image.ActualHeight == 0))
                {
                    var anim = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate(GetOpenTarget(readerSet, page), image);
                    anim.Configuration = new BasicConnectedAnimationConfiguration();
                }
            }

            Data.ShowReader  = true;
            Data.ReaderIndex = index;
            if (Data.UseVerticalReader)
            {
                await Task.Delay(100);

                var element = ReaderVertical.GetOrCreateElement(index);
                element.UpdateLayout();
                element.StartBringIntoView(new BringIntoViewOptions {
                    AnimationDesired = false, VerticalAlignmentRatio = 0f
                });
            }
            else
            {
                await ChangePage();
            }

            if (Data.Archive.isnew)
            {
                _wasNew = true;
            }
            if (Service.Platform.AnimationsEnabled)
            {
                FadeIn.Start(ReaderBackground);
                await FadeIn.StartAsync(ScrollViewer);
            }
            else
            {
                ReaderBackground.SetVisualOpacity(1);
                ScrollViewer.SetVisualOpacity(1);
            }

            _focus = true;
            FocusReader();
            _transition = false;
        }
Exemplo n.º 8
0
        public async void CloseReader()
        {
            if (_transition)
            {
                return;
            }
            _transition = true;
            var animate = Service.Platform.AnimationsEnabled;
            ConnectedAnimation animLeft = null, animRight = null;

            if (!Data.UseVerticalReader)
            {
                var left  = ReaderImage.FindDescendant("LeftImage");
                var right = ReaderImage.FindDescendant("RightImage");
                ReaderImage.disableAnimation = true;

                if (animate)
                {
                    if (Data.ReaderContent.LeftImage != null && !(left.ActualWidth == 0 || left.ActualHeight == 0))
                    {
                        animLeft = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("closeL", left);
                        animLeft.Configuration = new BasicConnectedAnimationConfiguration();
                    }
                    if (Data.ReaderContent.RightImage != null && !(right.ActualWidth == 0 || right.ActualHeight == 0))
                    {
                        animRight = ConnectedAnimationService.GetForCurrentView().PrepareToAnimate("closeR", right);
                        animRight.Configuration = new BasicConnectedAnimationConfiguration();
                    }
                }
            }

            _focus = false;
            int currentPage = Data.ReaderContent.Page;
            int count       = Data.Pages;

            int leftTarget  = currentPage;
            int rightTarget = currentPage;

            if (Data.ReaderContent.TwoPages)
            {
                leftTarget--;
                if (Data.ReadRTL)
                {
                    int tmp = leftTarget;
                    leftTarget  = rightTarget;
                    rightTarget = tmp;
                }
            }
            leftTarget  = leftTarget.Clamp(0, count - 1);
            rightTarget = rightTarget.Clamp(0, count - 1);
            if (animate)
            {
                if (Data.ReaderContent.LeftImage != null && animLeft != null && Data.ArchiveImages.Count > leftTarget)
                {
                    animLeft.TryStart(ImagesGrid.ContainerFromIndex(leftTarget).FindDescendant("Thumbnail"));
                }
                if (Data.ReaderContent.RightImage != null & animRight != null && Data.ArchiveImages.Count > rightTarget)
                {
                    animRight.TryStart(ImagesGrid.ContainerFromIndex(rightTarget).FindDescendant("Thumbnail"));
                }
                FadeOut.Start(ReaderBackground);
                await FadeOut.StartAsync(ScrollViewer);

                await Task.Delay(200);                 // Give it a sec
            }
            else
            {
                ReaderBackground.SetVisualOpacity(0);
                ScrollViewer.SetVisualOpacity(0);
            }
            Data.ShowReader = false;

            _wasNew = await Data.SaveReaderData(_wasNew);

            _transition = false;
        }
Exemplo n.º 9
0
        // быстрое сообщение

        // пагинация
        private void Continue(object sender, RoutedEventArgs e)
        {
            ImagesGrid.Reset(Models.Page.GetCurrentPage());
        }
Exemplo n.º 10
0
 private void ImagesScrollViewer_Loaded(object sender, RoutedEventArgs e)
 {
     //System.Diagnostics.Debug.WriteLine("ImagesScrollViewer_Loaded:");
     ImagesGrid.ImagesLoad();
 }