コード例 #1
0
        private async void btn_DelFav_Click(object sender, RoutedEventArgs e)
        {
            Story selectedStory = ((MenuFlyoutItem)sender).DataContext as Story;

            if (selectedStory != null)
            {
                //await CollectionDS.Instance.RemoveFav(selectedStory);
                await WebProvider.GetInstance().SendDeleteRequestAsync($"http://news-at.zhihu.com/api/4/favorite/{selectedStory.Id}");

                if (_viewModel.CollectionStories != null && _viewModel.CollectionStories.Count > 0)
                {
                    _viewModel.CollectionStories.Remove(selectedStory);
                    _viewModel.UpdateCount();
                }
                ToastPrompt.ShowToast("已成功取消收藏");
            }
        }
コード例 #2
0
        private async void _offlineNewsDownloader_OfflineProcessHandler(double process)
        {
            btn_Offline.Text      = "完成:" + (process * 100).ToString("0.0") + "%";
            progInd.ProgressValue = process;
            if (Math.Abs(process) == 1)
            {
                btn_Offline.Text = "离线下载";
                if (process == 1)
                {
                    ToastPrompt.ShowToast("离线下载完成");
                }
                await progInd.HideAsync();

                _offlineNewsDownloader.OfflineProcessHandler -= _offlineNewsDownloader_OfflineProcessHandler;
                _offlineNewsDownloader = null;
            }
        }