コード例 #1
0
ファイル: BookDisplayPageExt.cs プロジェクト: MewX/wenku10
        private async void OpenReader(object DataContext)
        {
            if (TryGetBookItem(DataContext, out BookItem BkItem))
            {
                AsyncTryOut <Chapter> TryAutoAnchor = await PageExtOperations.Run(PageProcessor.TryGetAutoAnchor(BkItem));

                if (TryAutoAnchor)
                {
                    PageProcessor.NavigateToReader(BkItem, TryAutoAnchor.Out);
                }
                else
                {
                    StringResources stx = StringResources.Load("Message");
                    await Popups.ShowDialog(UIAliases.CreateDialog(stx.Str("AnchorNotSetYet")));

                    OpenTOC(BkItem);
                }
            }
        }
コード例 #2
0
        private async void OpenUrl_Click(object sender, RoutedEventArgs e)
        {
            StringResources stx = StringResources.Load("AdvDM");

            DownloadBookContext Context = new DownloadBookContext();

            wenku10.Pages.Dialogs.Rename UrlBox = new wenku10.Pages.Dialogs.Rename(Context, stx.Text("Download_Location"))
            {
                Placeholder = "http://example.com/NN. XXXX.txt"
            };

            await Popups.ShowDialog(UrlBox);

            if (UrlBox.Canceled)
            {
                return;
            }

            TaskCompletionSource <bool> TCS = new TaskCompletionSource <bool>();

            RuntimeCache rCache = new RuntimeCache();

            MessageBus.Send(GetType(), string.Format("{0}. {1}", Context.Id, Context.Title));

            rCache.GET(Context.Url, (DArgs, url) =>
            {
                SaveTemp(DArgs, Context);

                TCS.SetResult(true);
            }
                       , (id, url, ex) =>
            {
                Logger.Log(ID, ex.Message, LogType.WARNING);

                MessageBus.Send(GetType(), "Cannot download: " + id);
                TCS.SetResult(true);
            }, false);

            await PageExtOperations.Run(TCS.Task);
        }
コード例 #3
0
ファイル: ZSViewSource.cs プロジェクト: MewX/wenku10
 private async void RowAction(IGRRow _Row)
 {
     await PageExtOperations.Run(_RowAction( _Row ));
 }