Example #1
0
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter != null)
            {
                if (e.Parameter is WebArticleData)
                {
                    var sourceData = e.Parameter as WebArticleData;
                    WebArticleHandle(sourceData);
                }
                else if (e.Parameter is string)
                {
                    string date = e.Parameter as string;
                    string url  = AppTools.SOMEDAY_URL + date;
                    WaittingRing.IsActive = true;
                    var webData = await AppTools.GetAsyncJson <WebArticleModel>(url);

                    WaittingRing.IsActive = false;
                    if (webData != null)
                    {
                        WebArticleHandle(webData.Data);
                    }
                }
                var anim = ConnectedAnimationService.GetForCurrentView().GetAnimation("ForwardConnectedAnimation");
                if (anim != null)
                {
                    anim.TryStart(HeaderContainer);
                }
            }
        }
Example #2
0
        private async void RandomArticleInit()
        {
            WaittingRing.Visibility = Visibility.Visible;
            MainContent.Visibility  = Visibility.Collapsed;
            var webArticle = await AppTools.GetAsyncJson <WebArticleModel>(AppTools.RANDOM_URL);

            UserInterfaceInit(webArticle);
        }
Example #3
0
        private async void TodayArticleInit()
        {
            RandomButton.Visibility = Visibility.Collapsed;
            WaittingRing.Visibility = Visibility.Visible;
            MainContent.Visibility  = Visibility.Collapsed;
            var webArticle = await AppTools.GetAsyncJson <WebArticleModel>(AppTools.TODAY_URL);

            UserInterfaceInit(webArticle);
        }
Example #4
0
        private async void NextButton_Click(object sender, RoutedEventArgs e)
        {
            MainPage.Current.NextPageHandle();
            WaittingRing.IsActive = true;
            var webData = await AppTools.GetAsyncJson <WebArticleModel>(AppTools.RANDOM_URL);

            WaittingRing.IsActive = false;
            if (webData != null)
            {
                var article = new AppArticleModel(webData.Data);
                MainPage.Current.AddRecentArticle(article);
                WebArticleHandle(webData.Data);
            }
        }
Example #5
0
        private async void DateSearchTextBox_KeyDown(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key == Windows.System.VirtualKey.Enter)
            {
                string date = DateSearchTextBox.Text.Trim();
                if (string.IsNullOrEmpty(date))
                {
                    new PopToast("日期不能为空哟").ShowPopup();
                    return;
                }
                Regex dateReg = new Regex("^((((([1|2])[0-9]{1})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[13579][26])00))0229)|([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})(((0[13578]|1[02])(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)(0[1-9]|[12][0-9]|30))|(02(0[1-9]|[1][0-9]|2[0-8]))))$");
                if (dateReg.IsMatch(date))
                {
                    var parseDate = AppTools.GetDateTime(date);
                    if (parseDate < new DateTime(2011, 3, 8))
                    {
                        new PopToast("最远只能到2011年3月8日哦~").ShowPopup();
                    }
                    else if (parseDate > DateTime.Now)
                    {
                        new PopToast("软件尚未提供预知能力哟~").ShowPopup();
                    }
                    else
                    {
                        WaittingRing.Visibility = Visibility.Visible;
                        MainContent.Visibility  = Visibility.Collapsed;
                        var webArticle = await AppTools.GetAsyncJson <WebArticleModel>(AppTools.SOMEDAY_URL + date);

                        UserInterfaceInit(webArticle);
                    }
                }
                else
                {
                    var dialog = new ConfirmDialog("日期提醒", "日期的输入是有一定格式的:\n比如说要查找2018年1月1日的文章,则应输入-\n20180101\n\n输入201811或者2018/1/1这些都是不行的哟~", "");
                    await dialog.ShowAsync();
                }
            }
        }