示例#1
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            switch (listContent)
            {
            case ListContent.Recommend:
                Data.OverAll.RecommendList.PauseLoading();
                break;

            case ListContent.Bookmark:
                Data.OverAll.BookmarkList.PauseLoading();
                break;

            case ListContent.Following:
                Data.OverAll.FollowingList.PauseLoading();
                break;

            case ListContent.Ranking:
                Data.OverAll.RankingList.PauseLoading();
                break;
            }
            base.OnNavigatedFrom(e);
            if (!_backflag)
            {
                Data.Backstack.Default.Push(typeof(WaterfallPage), (listContent, clickedIndex));
                TheMainPage?.UpdateNavButtonState();
            }
        }
示例#2
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     base.OnNavigatedFrom(e);
     if (!_backflag)
     {
         Data.Backstack.Default.Push(typeof(SettingsPage), null);
         TheMainPage?.UpdateNavButtonState();
     }
 }
示例#3
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     TheMainPage?.SelectNavPlaceholder(GetResourceString("UserDetailPagePlain"));
     userid      = (int)e.Parameter;
     itemsSource = new UserIllustsCollection(userid.ToString());
     itemsSource.CollectionChanged += ItemsSource_CollectionChanged;
     WaterfallListView.ItemsSource  = itemsSource;
     base.OnNavigatedTo(e);
     _ = loadContents();
 }
示例#4
0
        public void GoToContactPageAndSendMessage()
        {
            var contactPage = TheMainPage.ClickContactUsLink();

            string  filePath = WebDriverFactory.CreateFileAndReturnPath();
            Message message  = new Message("*****@*****.**", "test", filePath, "messae");

            contactPage.FillFormAndClickSubmit(message);
            Assert.IsTrue(contactPage.MessageWasSendCorrectly());
        }
示例#5
0
 protected override void OnNavigatedFrom(NavigationEventArgs e)
 {
     itemsSource?.StopLoading();
     itemsSource = null;
     base.OnNavigatedFrom(e);
     if (!_backflag)
     {
         Data.Backstack.Default.Push(typeof(UserDetailPage), userid);
         TheMainPage?.UpdateNavButtonState();
     }
 }
示例#6
0
        private async void QuickSave_Click(object sender, RoutedEventArgs e)
        {
            if (tapped == null)
            {
                return;
            }
            var i = tapped;

            try
            {
                FileSavePicker picker = new FileSavePicker();
                picker.SuggestedStartLocation = PickerLocationId.PicturesLibrary;
                picker.FileTypeChoices.Add(GetResourceString("ImageFilePlain"), new List <string>()
                {
                    ".png"
                });
                picker.SuggestedFileName = i.Title;
                var file = await picker.PickSaveFileAsync();

                if (file != null)
                {
                    CachedFileManager.DeferUpdates(file);
                    var res = await new PixivAppAPI(Data.OverAll.GlobalBaseAPI)
                              .GetIllustDetailAsync(i.ItemId.ToString());
                    var illust = Data.IllustDetail.FromObject(res);
                    using (var imgstream = await Data.OverAll.DownloadImage(illust.OriginalUrls[0]))
                    {
                        using (var filestream = await file.OpenAsync(FileAccessMode.ReadWrite))
                        {
                            await imgstream.CopyToAsync(filestream.AsStream());
                        }
                    }
                    var updateStatus = await CachedFileManager.CompleteUpdatesAsync(file);

                    if (updateStatus == FileUpdateStatus.Complete)
                    {
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("WorkSavedPlain"), i.Title));
                    }
                    else
                    {
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("WorkSaveFailedPlain"), i.Title));
                    }
                }
            }
            catch
            {
                await TheMainPage?.ShowTip(string.Format(GetResourceString("WorkSaveFailedPlain"), i.Title));
            }
        }
示例#7
0
        private void ComboBox_DropDownClosed(object sender, object e)
        {
            if (sender is ComboBox cb)
            {
                // 保存颜色主题信息
                switch (cb.SelectedIndex)
                {
                case 2:
                    ApplicationData.Current.LocalSettings.Values["ColorTheme"] = null;
                    break;

                case 0:
                    ApplicationData.Current.LocalSettings.Values["ColorTheme"] = false;
                    break;

                case 1:
                    ApplicationData.Current.LocalSettings.Values["ColorTheme"] = true;
                    break;
                }
                _ = TheMainPage?.ShowTip(GetResourceString("RestartApplyColorTheme"));
            }
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            TheMainPage?.SelectNavPlaceholder(GetResourceString("UserDetailPagePlain"));

            //治标不治本的加载逻辑……反正个人插画也不会太多,全部重载就好)
            if (e.Parameter is ValueTuple <int, bool> tuple)
            {
                Data.OverAll.UserList?.StopLoading();
                userid = tuple.Item1;
                _      = loadContents();
                //Data.OverAll.RefreshUserList(userid.ToString()); 治 本 (需删除85行并修改Collection中的瀑布流控制逻辑)
            }
            else if (e.Parameter is int id)
            {
                userid = id;
                grdDetail.Visibility = Visibility.Collapsed;
            }
            Data.OverAll.RefreshUserList(userid.ToString()); //治 标
            Data.OverAll.UserList.ResumeLoading();
            itemsSource = OverAll.UserList;
            itemsSource.CollectionChanged += ItemsSource_CollectionChanged;
            WaterfallListView.ItemsSource  = itemsSource;
            base.OnNavigatedTo(e);
        }
示例#9
0
        private async void QuickStar_Click(object sender, RoutedEventArgs e)
        {
            if (tapped == null)
            {
                return;
            }
            var i     = tapped;
            var title = i.Title;

            try
            {
                //用Title作标识,表明任务是否在执行
                i.Title = null;
                if (i.IsBookmarked)
                {
                    bool res;
                    try
                    {
                        await new PixivAppAPI(Data.OverAll.GlobalBaseAPI)
                        .PostIllustBookmarkDeleteAsync(i.ItemId.ToString());
                        res = true;
                    }
                    catch
                    {
                        res = false;
                    }
                    i.Title = title;
                    if (res)
                    {
                        i.IsBookmarked = false;
                        i.Stars--;
                        i.NotifyChange("StarsString");
                        i.NotifyChange("IsBookmarked");
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("DeletedBookmarkPlain"), title));
                    }
                    else
                    {
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("BookmarkDeleteFailedPlain"), title));
                    }
                }
                else
                {
                    bool res;
                    try
                    {
                        await new PixivAppAPI(Data.OverAll.GlobalBaseAPI)
                        .PostIllustBookmarkAddAsync(i.ItemId.ToString());
                        res = true;
                    }
                    catch
                    {
                        res = false;
                    }
                    i.Title = title;
                    if (res)
                    {
                        i.IsBookmarked = true;
                        i.Stars++;
                        i.NotifyChange("StarsString");
                        i.NotifyChange("IsBookmarked");
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("WorkBookmarkedPlain"), title));
                    }
                    else
                    {
                        await TheMainPage?.ShowTip(string.Format(GetResourceString("WorkBookmarkFailedPlain"), title));
                    }
                }
            }
            finally
            {
                //确保出错时数据不被破坏
                i.Title = title;
            }
        }
示例#10
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     TheMainPage?.SelectNavPlaceholder(GetResourceString("SettingsPagePlain"));
 }
示例#11
0
        public void TC5()
        {
            var signInPage = TheMainPage.ClickSignInLink();

            Assert.IsTrue(signInPage.PageIsLoadedCorrectly());
        }
示例#12
0
        public void TC4()
        {
            var contactPage = TheMainPage.ClickContactUsLink();

            Assert.IsTrue(contactPage.PageIsLoadedCorrectly());
        }
示例#13
0
        public void SearchForProduct()
        {
            var searchPageResult = TheMainPage.FillSearchFieldAndClick();

            Assert.IsTrue(searchPageResult.ProductIsVisible);
        }