示例#1
0
 virtual protected void SetTOC(BookItem b)
 {
     TOCData = new TOCSection(b);
     JumpMarkBtn.SetBinding(IsEnabledProperty, new Binding()
     {
         Source = TOCData, Path = new PropertyPath("AnchorAvailable")
     });
 }
示例#2
0
        public static async Task <AsyncTryOut <Chapter> > TryGetAutoAnchor(BookItem Book, bool Sync = true)
        {
            StringResources stx = StringResources.Load("LoadingMessage");

            if (Sync)
            {
                MessageBus.SendUI(typeof(PageProcessor), stx.Str("SyncingAnchors"), Book.ZItemId);
                await new AutoAnchor(Book).SyncSettings();
            }

            MessageBus.SendUI(typeof(PageProcessor), stx.Str("ProgressIndicator_Message"), Book.ZItemId);

            TaskCompletionSource <TOCSection> TCS = new TaskCompletionSource <TOCSection>();
            BookLoader BLoader = new BookLoader(b =>
            {
                if (b == null)
                {
                    TCS.TrySetResult(null);
                }
                else
                {
                    MessageBus.SendUI(typeof(PageProcessor), stx.Str("LoadingVolumes"), Book.ZItemId);
                    new VolumeLoader(b2 =>
                    {
                        if (b2 == null)
                        {
                            TCS.TrySetResult(null);
                        }
                        else
                        {
                            TCS.TrySetResult(new TOCSection(b2));
                        }
                    }).Load(b);
                }
            });

            BLoader.Load(Book, true);

            TOCSection TOCData = await TCS.Task;

            if (TOCData == null)
            {
                return(new AsyncTryOut <Chapter>(false, null));
            }

            if (TOCData.AnchorAvailable)
            {
                return(new AsyncTryOut <Chapter>(true, TOCData.AutoAnchor));
            }
            else
            {
                return(new AsyncTryOut <Chapter>(false, TOCData.FirstChapter));
            }
        }
示例#3
0
        private void Dispose()
        {
            NavigationHandler.OnNavigatedBack -= OnBackRequested;
            ThisBook = null;
            TOCData = null;
            VolList = null;

            try
            {
                // Try Dispose
                Worker.UIInvoke( () =>
                {
                    TOCSection.DataContext = null;
                    CommentFrame.Content = null;
                    BookInfoSection.DataContext = null;
                } );
            }
            catch ( Exception ) { }
        }
示例#4
0
        private async void GoToContentReader( BookItem b )
        {
            TOCData = new TOCSection( b );
            if ( TOCData.AnchorAvailable )
            {
                await Dispatcher.RunAsync(
                    CoreDispatcherPriority.Normal
                    , () => Frame.Navigate( typeof( ContentReader ), TOCData.AutoAnchor )
                );
                return;
            }

            EpisodeStepper ES = new EpisodeStepper( new VolumesInfo( b ) );
            ES.StepNext();

            await OneDriveRsync();
            await Dispatcher.RunAsync(
                CoreDispatcherPriority.Normal
                , () => Frame.Navigate(
                    typeof( ContentReader )
                    , new Chapter( ES.EpTitle, b.Id, ES.Vid, ES.Cid )
                )
            );
        }
示例#5
0
        private void SetTemplateTOC( BookItem b )
        {
            TOCData = new TOCSection( b );
            TOCData.TemplateSelector.IsHorizontal = LayoutSettings.HorizontalTOC;

            TOCSection.DataContext = TOCData;
            TOCFloatSection.DataContext = TOCData;

            TOCData.SetViewSource( VolumesViewSource );

            if ( VolList != null && 0 < VolList.Items.Count() )
            {
                VolList.SelectedIndex = 0;
            }
        }