コード例 #1
0
        private void ShowToastIfNeeded(DeckListViewModel deckListViewModel)
        {
            var  settings = ApplicationData.Current.LocalSettings;
            bool isShown;

            if (settings.Values.ContainsKey("IsEnableNotifciation"))
            {
                isShown = (bool)settings.Values["IsEnableNotifciation"];
            }
            else
            {
                settings.Values["IsEnableNotifciation"] = true;
                isShown = true;
            }

            if (!isShown)
            {
                return;
            }

            if (ToastHelper.IsAlreadyShown())
            {
                return;
            }

            string message = String.Format("You have {0} new card(s) and {1} due card(s) to review today.",
                                           deckListViewModel.TotalNewCards,
                                           deckListViewModel.TotalDueCards);
            var toast = ToastHelper.CreateToast("Review", message);

            ToastHelper.PopToast(toast);
            ToastHelper.MarkAlreadyShown();
        }
コード例 #2
0
        public void showToast(ToastTemplateType type)
        {
            var xmlDoc       = ToastHelper.CreateToast(this, type);
            var notification = new ToastNotification(xmlDoc);

            _toastNotifier.Show(notification);
        }
コード例 #3
0
        public void Execute(Dictionary <string, object> arguments)
        {
            string headerText = (string)arguments["HeaderText"];
            string alertText  = (string)arguments["AlertText"];
            bool   persistent = (bool)arguments["Persistent"];

            string      toastId  = (++TOAST_COUNTER).ToString();
            XmlDocument document = ToastHelper.BuildToastXml(toastId, headerText, alertText, persistent);

            if (arguments.ContainsKey("Delay"))
            {
                long delay = long.Parse(arguments["Delay"].ToString());
                ToastHelper.ScheduleToast(toastId, document, delay);
            }
            else
            {
                ToastHelper.CreateToast(document);
            }
        }