コード例 #1
0
 public static INotificationMessage Alert(string message, UINotificationType type = UINotificationType.None, Action closeAction = null)
 {
     return(Default()
            .HasMessage(message)
            .Dismiss().WithButton("Close", button => { closeAction?.Invoke(); })
            .WithBadgeType(type)
            .Queue());
 }
コード例 #2
0
 public static INotificationMessage Alert(string message, UINotificationType type = UINotificationType.None, Action closeAction = null)
 {
     return(Application.Current.Dispatcher.Invoke(() =>
     {
         return Default()
         .HasMessage(message)
         .Dismiss().WithButton("Close", button => { closeAction?.Invoke(); })
         .WithBadgeType(type)
         .Queue();
     }, DispatcherPriority.Normal));
 }
コード例 #3
0
    public void queueNotification(
        string title,
        string description,
        double score,
        UINotificationType notificationType)
    {
        UINotificationItem notification = new UINotificationItem();

        notification.title            = title;
        notification.description      = description;
        notification.notificationType = notificationType;
        notification.score            = score.ToString("N0");
        QueueNotification(notification);
    }
コード例 #4
0
        public void ShowAlert(string message, string title = null, UINotificationType type = UINotificationType.None)
        {
            if (!NotificationTypeToMessageBoxImage.TryGetValue(type, out var image))
            {
                image = MessageBoxImage.None;
            }

            MessageBox.Show(
                message,
                string.IsNullOrEmpty(title) ? AppConstants.Application.DisplayName : title,
                MessageBoxButton.OK,
                image
                );
        }
コード例 #5
0
    // NOTIFICATION

    public static void QueueNotification(
        string title,
        string description,
        double score,
        UINotificationType notificationType)
    {
        if (Instance != null)
        {
            Instance.queueNotification(
                title,
                description,
                score,
                notificationType);
        }
    }
コード例 #6
0
    public void ShowNotificationContainerType(UINotificationType type)
    {
        if (type == UINotificationType.Achievement)
        {
            GameObjectHelper.ShowObject(notificationContainerAchievement);
        }
        else
        {
            GameObjectHelper.HideObject(notificationContainerAchievement);
        }

        if (type == UINotificationType.Point)
        {
            GameObjectHelper.ShowObject(notificationContainerPoint);
        }
        else
        {
            GameObjectHelper.HideObject(notificationContainerPoint);
        }

        if (type == UINotificationType.Error)
        {
            GameObjectHelper.ShowObject(notificationContainerError);
        }
        else
        {
            GameObjectHelper.HideObject(notificationContainerError);
        }

        if (type == UINotificationType.Tip)
        {
            GameObjectHelper.ShowObject(notificationContainerTip);
        }
        else
        {
            GameObjectHelper.HideObject(notificationContainerTip);
        }

        if (type == UINotificationType.Info)
        {
            GameObjectHelper.ShowObject(notificationContainerInfo);
        }
        else
        {
            GameObjectHelper.HideObject(notificationContainerInfo);
        }
    }
コード例 #7
0
        public static NotificationMessageBuilder WithBadgeType(this NotificationMessageBuilder builder, UINotificationType type)
        {
            switch (type)
            {
            case UINotificationType.Info:
                builder.SetBadge("Info");
                builder.Message.BadgeAccentBrush =
                    new SolidColorBrush(Color.FromRgb(2, 160, 229));
                break;

            case UINotificationType.Warning:
                builder.SetBadge("Warn");
                builder.Message.BadgeAccentBrush =
                    new SolidColorBrush(Color.FromRgb(224, 160, 48));
                break;

            case UINotificationType.Error:
                builder.SetBadge("Error");
                builder.Message.BadgeAccentBrush =
                    new SolidColorBrush(Color.FromRgb(232, 13, 0));
                break;
            }

            return(builder);
        }