コード例 #1
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();
            try
            {
                ToastHelper.PopToast("TEST TITLE", "content");
                using (var collection = await Storage.OpenOrCreateCollection(Storage.AppLocalFolder, Constant.COLLECTION_NAME))
                {
                    var deckListViewModel = new DeckListViewModel(collection);
                    deckListViewModel.GetAllDeckInformation();
                    await deckListViewModel.UpdateAllSecondaryTilesIfHas();

                    if (deckListViewModel.TotalNewCards + deckListViewModel.TotalDueCards > 0)
                    {
                        string message = String.Format("You have {0} new card(s) and {1} due card(s) to review.",
                                                       deckListViewModel.TotalNewCards,
                                                       deckListViewModel.TotalDueCards);
                        ToastHelper.PopToast("Review cards", message);
                    }
                }
            }
            catch
            {
            }
            finally
            {
                deferral.Complete();
            }
        }
コード例 #2
0
        public async void Run(IBackgroundTaskInstance taskInstance)
        {
            deferral = taskInstance.GetDeferral();
            await EnableCancelOfTask(taskInstance);

            try
            {
                using (var collection = await Storage.OpenCollection(Storage.AppLocalFolder, Constant.COLLECTION_NAME))
                {
                    var deckListViewModel = new DeckListViewModel(collection);
                    deckListViewModel.GetAllDeckInformation();
                    await deckListViewModel.UpdateAllSecondaryTilesIfHas();

                    if (deckListViewModel.TotalNewCards + deckListViewModel.TotalDueCards > 0)
                    {
                        if (taskInstance.Task.Name.Equals(Shared.AnkiDeckBackgroundRegisterHelper.SYSTEM_TRIGGERED_TASK_NAME, StringComparison.OrdinalIgnoreCase))
                        {
                            ShowToastIfNeeded(deckListViewModel);
                        }
                    }
                }
            }
            catch
            {
            }
            finally
            {
                deferral.Complete();
            }
        }
コード例 #3
0
 private void GetDecksInformation()
 {
     deckListViewModel = new DeckListViewModel(mainPage.Collection);
     deckListViewModel.GetAllDeckInformation();
 }