Beispiel #1
0
        private string GetNotificationSecondaryDescription(ScoreDiffItem diff)
        {
            string key;
            int    score = diff.NewScore;

            if (diff.IsMakeup)
            {
                key = score < 60 ? "ScoreChangedNotificationDescMakeupFail" : "ScoreChangedNotificationDescMakeupPass";
            }
            else
            {
                switch (score)
                {
                case < 60:
                    key = "ScoreChangedNotificationDescInitialFail";
                    break;

                case < 80:
                    key = "ScoreChangedNotificationDescInitialMediocre";
                    break;

                case < 90:
                    key = "ScoreChangedNotificationDescInitialGood";
                    break;

                default:
                    key = "ScoreChangedNotificationDescInitialExcellent";
                    break;
                }
            }
            return(locService.GetString(key));
        }
Beispiel #2
0
        private string GetNotificationEmojiUri(ScoreDiffItem diff)
        {
            string key;
            int    score = diff.NewScore;

            if (diff.IsMakeup)
            {
                key = score < 60 ? "ScoreChangedNotificationEmojiFail" : "ScoreChangedNotificationEmojiMediocre";
            }
            else
            {
                switch (score)
                {
                case < 60:
                    key = "ScoreChangedNotificationEmojiFail";
                    break;

                case < 80:
                    key = "ScoreChangedNotificationEmojiMediocre";
                    break;

                case < 90:
                    key = "ScoreChangedNotificationEmojiGood";
                    break;

                default:
                    key = "ScoreChangedNotificationEmojiExcellent";
                    break;
                }
            }
            return(locService.GetString(key));
        }
Beispiel #3
0
        private WindowsPushNotification GetNotification(ScoreDiffItem diff)
        {
            string title = GetNotificationTitle(diff);
            string primaryDescription   = GetNotificationPrimaryDescription(diff);
            string secondaryDescription = GetNotificationSecondaryDescription(diff);
            string emojiUri             = GetNotificationEmojiUri(diff);

            ToastContent toastContent = new ToastContent()
            {
                Visual = new ToastVisual()
                {
                    BindingGeneric = new ToastBindingGeneric()
                    {
                        Children =
                        {
                            new AdaptiveText()
                            {
                                Text      = title,
                                HintStyle = AdaptiveTextStyle.Title
                            },
                            new AdaptiveText()
                            {
                                Text         = primaryDescription,
                                HintMaxLines = 2
                            },
                            new AdaptiveText()
                            {
                                Text      = secondaryDescription,
                                HintStyle = AdaptiveTextStyle.CaptionSubtle
                            }
                        },
                        AppLogoOverride = new ToastGenericAppLogo()
                        {
                            Source = emojiUri,
                        }
                    }
                },
                Actions = new ToastActionsCustom()
                {
                    ContextMenuItems =
                    {
                        new ToastContextMenuItem("ms-resource:ScoreChangedToastNeverShow", "NeverShowScoreChanged")
                        {
                            ActivationType = ToastActivationType.Background
                        }
                    }
                },
                Launch = "ScoreChanged"
            };

            return(new WindowsPushNotification(WindowsNotificationType.Toast, toastContent.GetContent()));
        }
Beispiel #4
0
        private string GetNotificationTitle(ScoreDiffItem diff)
        {
            string title;

            switch (diff.DiffType)
            {
            case ScoreDiffType.Add:
                title = locService.GetString("ScoreChangedNotificationTitleAdd");
                break;

            case ScoreDiffType.Change:
                title = locService.GetString("ScoreChangedNotificationTitleModify");
                break;

            default:
                title = string.Empty;
                break;
            }
            return(title);
        }
Beispiel #5
0
        private string GetNotificationPrimaryDescription(ScoreDiffItem diff)
        {
            string key = diff.DiffType == ScoreDiffType.Change ? "ScoreChangedNotificationDescModify" : "ScoreChangedNotificationDescAdd";

            return(locService.GetString(key, locService.DefaultCulture, diff.ShortName));
        }