示例#1
0
        private async void AddToSubscription_Click(object sender, RoutedEventArgs e)
        {
            IsAddToSubBusy = true;
            ViewModels.ScheduleModel sm = (ViewModels.ScheduleModel)((MenuItem)sender).DataContext;
            AnimeAPI api = new AnimeAPI();

            try
            {
                await api.AddAnime(sm.aid);

                ToastPrompt toast = new ToastPrompt();
                toast.Title    = "成功将 " + sm.name + " 添加到 我的订阅";
                toast.FontSize = 20;
                toast.Show();
                RefreshSubscription();
            }
            catch (Exception excepiton)
            {
                MessageBox.Show(excepiton.Message, "错误", MessageBoxButton.OK);
                if (api.lastError == AnimeAPI.ERROR.ERROR_INVALID_KEY)
                {
                    settings.Remove("UserKey");
                    settings.Save();
                    NavigationService.Navigate(new Uri("/LoginPage.xaml", UriKind.Relative));
                }
            }
            finally
            {
                IsAddToSubBusy = false;
            }
        }
示例#2
0
 private void OpenAnimeIntro_Tap(object sender, System.Windows.Input.GestureEventArgs e)
 {
     ViewModels.ScheduleModel item = ((sender as Grid).DataContext as ViewModels.ScheduleModel);
     NavigationService.Navigate(new Uri("/AnimeIntroPage.xaml?aid=" + item.aid + "&title=" + item.name, UriKind.Relative));
 }