Ejemplo n.º 1
0
        private static void Show(string message, [NotNull] Notify notify, [CanBeNull] NotifyMessageOptions nMsgOpt,
                                 NotifyType type)
        {
            if (nMsgOpt == null)
            {
                nMsgOpt = new NotifyMessageOptions();
            }
            var msgOpt = new MessageOptions
            {
                CloseClickAction     = n => { nMsgOpt.CloseClickAction?.Invoke(); },
                UnfreezeOnMouseLeave = nMsgOpt.UnfreezeOnMouseLeave,
                FontSize             = nMsgOpt.FontSize,
                FreezeOnMouseEnter   = nMsgOpt.FreezeOnMouseEnter,
                ShowCloseButton      = nMsgOpt.ShowCloseButton,
                Tag = nMsgOpt.Tag,
                NotificationClickAction = n =>
                {
                    n.CanClose = true;
                    n.Close();
                    nMsgOpt.NotificationClickAction?.Invoke();
                }
            };

            switch (type)
            {
            case NotifyType.Information:
                notify.notifier.ShowInformation(message, msgOpt);
                break;

            case NotifyType.Success:
                notify.notifier.ShowSuccess(message, msgOpt);
                break;

            case NotifyType.Warning:
                notify.notifier.ShowWarning(message, msgOpt);
                break;

            case NotifyType.Error:
                notify.notifier.ShowError(message, msgOpt);
                break;

            default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Показать уведомление
 /// </summary>
 /// <param name="message">Сообщение</param>
 /// <param name="type">Тип</param>
 /// <param name="msgOpt">настройки сообщения</param>
 public void Show(string message, NotifyType type         = NotifyType.Information,
                  [CanBeNull] NotifyMessageOptions msgOpt = null)
 {
     Show(message, this, msgOpt, type);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Показать уведомление на основном экране с дефолтными настройками
 /// </summary>
 /// <param name="message">Сообщение</param>
 /// <param name="type">Тип</param>
 /// <param name="msgOpt">настройки сообщения</param>
 public static void ShowOnScreen(string message, NotifyType type         = NotifyType.Information,
                                 [CanBeNull] NotifyMessageOptions msgOpt = null)
 {
     Show(message, notifyScreen, msgOpt, type);
 }