Ejemplo n.º 1
0
 public NotificationModel(string key, string message, ENotificationType notificationType = ENotificationType.BusinessRules)
 {
     NotificationId   = Guid.NewGuid();
     Key              = key;
     Message          = message;
     NotificationType = notificationType;
 }
Ejemplo n.º 2
0
 public void Add(ENotificationType notificationType, string message)
 {
     _notifications.Add(new Notification
     {
         NotificationType = notificationType,
         Message          = message
     });
 }
Ejemplo n.º 3
0
 public void AddNotification(string message, ENotificationType type)
 {
     Messages.Add(new Notification
     {
         Message          = message,
         NotificationType = type
     });
 }
        /// <summary>
        /// Outputs the notification message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="notificationType">Type of the notification.</param>
        private void _outputNotificationMessage(String message, ENotificationType notificationType = ENotificationType.Info)
        {
            if (!string.IsNullOrWhiteSpace(message))
            {
                switch (notificationType)
                {
                case ENotificationType.Warning:
                case ENotificationType.Error:
                    this.Logger.Warning($"General notification: {message}");
                    break;

                default:
                    this.Logger.Information($"General notification: {message}");
                    break;
                }
            }

            lock (_genericNotificationPanelLockObject)
            {
                GenericNotificationPanel   = GENERIC_OPEN_PANEL_HEIGHT;
                GenericNotificationMessage = message;
                GenericNotificationType    = notificationType;

                //TODO : Use Xaml to change the OPACITY of the control rather than doing it programatically
                if ((int)GenericMessageOpacity <= 0)
                {
                    // Tasking prevents the UI thread from being locked up
                    var task = Task.Factory.StartNew(() =>
                    {
                        GenericMessageOpacity = 0;
                        for (int i = 0; i < 20; i++)
                        {
                            GenericMessageOpacity += 0.05;
                            Application.DoEvents();
                            Thread.Sleep(50);
                        }
                    });
                }

                if (GenericNotificationPanel != 0)
                {
                    // Tasking prevents the UI thread from being locked up
                    var task2 = Task.Factory.StartNew(() =>
                    {
                        Thread.Sleep(6000);
                        for (int i = 0; i < 20; i++)
                        {
                            GenericMessageOpacity -= 0.05;
                            Application.DoEvents();
                            Thread.Sleep(25);
                        }
                        GenericNotificationPanel = 0;
                        Application.DoEvents();
                    });
                }
            }
        }
Ejemplo n.º 5
0
 private static void ShowNotificationInDesktop(string message, ENotificationType type)
 {
     Action action = type switch
     {
         ENotificationType.Success => () => Growl.SuccessGlobal(message),
         ENotificationType.Info => () => Growl.InfoGlobal(message),
         ENotificationType.Warning => () => Growl.WarningGlobal(message),
         ENotificationType.Error => () => Growl.ErrorGlobal(message),
         ENotificationType.Fatal => () => Growl.FatalGlobal(message),
         _ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
     };
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Background, action);
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Push a notification to the Streamlabs OBS notification system.
        /// </summary>
        /// <param name="con">IConnection connection to Streamlabs OBS.</param>
        /// <param name="message">Message to be pushed to Streamlabs OBS (appends "Remote: ").</param>
        /// <param name="type">Type of the notification, default to Warning.</param>
        private static void SendNotification(IConnection con, string message, ENotificationType type = ENotificationType.WARNING)
        {
            // Create argument object
            object[] args = new object[]
            {
                new NotifictionOptions($"Remote: {message}")
                {
                    Type = type
                }
            };

            // Send push notifcation to Streamlabs OBS
            new Request <Notification>("push", "NotificationsService", args).GetResponse(con);
        }
Ejemplo n.º 7
0
 public void ShowNotification(string message, ENotificationType type, ENotificationCategory category)
 {
     switch (category)
     {
         case ENotificationCategory.App:
             ShowNotificationInApp(message, type);
             break;
         case ENotificationCategory.Desktop:
             ShowNotificationInDesktop(message, type);
             break;
         default:
             throw new ArgumentOutOfRangeException(nameof(category), category, null);
     }
 }
Ejemplo n.º 8
0
 internal Notification(ENotificationType notificationType)
 {
     NotificationType = notificationType;
 }
Ejemplo n.º 9
0
        private void ShowNotification(string message, ENotificationType notificationType)
        {
            if (lblNotificationStart.InvokeRequired)
            {
                ShowNotificationCallBack d = new ShowNotificationCallBack(ShowNotification);
                this.Invoke(d, new object[] { message, notificationType });
            }
            else
            {
                // hide loading
                HideLoading();

                // show success message only if it is activated in configuration.
                bool showSuccessMessage = Convert.ToBoolean(ConfigurationManager.AppSettings["wGengo_showSuccessMsg"]);
                if (notificationType == ENotificationType.Success && !showSuccessMessage)
                    return;

                lblNotificationStart.Text = message;
                lblNotificationOrder.Text = message;
                lblNotificationOverview.Text = message;
                lblNotificationView.Text = message;
                lblNotificationReview.Text = message;
                lblNotificationCorrect.Text = message;
                lblNotificationReject.Text = message;

                Color color = (notificationType == ENotificationType.Success) ? System.Drawing.Color.Green : System.Drawing.Color.Red;
                lblNotificationStart.ForeColor = color;
                lblNotificationOrder.ForeColor = color;
                lblNotificationOverview.ForeColor = color;
                lblNotificationView.ForeColor = color;
                lblNotificationReview.ForeColor = color;
                lblNotificationCorrect.ForeColor = color;
                lblNotificationReject.ForeColor = color;

                lblNotificationStart.Visible = true;
                lblNotificationOrder.Visible = true;
                lblNotificationOverview.Visible = true;
                lblNotificationView.Visible = true;
                lblNotificationReview.Visible = true;
                lblNotificationCorrect.Visible = true;
                lblNotificationReject.Visible = true;
            }
        }
Ejemplo n.º 10
0
 public Notification(string message, ENotificationType type, string subject)
 {
     Message = message;
     Type    = type;
     Subject = subject;
 }
Ejemplo n.º 11
0
 public void AddNotification(string key, string message, ENotificationType notificationType)
 {
     _notifications.Add(new NotificationModel(key, message, notificationType));
 }
Ejemplo n.º 12
0
				internal Notification(ENotificationType notificationType) {
					NotificationType = notificationType;
				}
 public GenericWebsiteEventArgs()
 {
     NotificationType = ENotificationType.Info;
 }
Ejemplo n.º 14
0
 internal NotificationCallback(CMsgClientUserNotifications.Notification body)
 {
     NotificationType = (ENotificationType)body.user_notification_type;
 }
Ejemplo n.º 15
0
 public void ShowDesktopNotification(string message, ENotificationType type) => ShowNotificationInDesktop(message, type);
Ejemplo n.º 16
0
 public void ShowAppNotification(string message, ENotificationType type) => ShowNotificationInApp(message, type);
Ejemplo n.º 17
0
 public void Handle(string message, ENotificationType notificationType = ENotificationType.Business)
 {
     _notifications.Add(new NotificationModel(message, notificationType));
 }
Ejemplo n.º 18
0
 public TaskNotificationEventArgs(string message, string taskId, string taskName, ENotificationType notificationType)
 {
     Message  = message; TaskId = taskId; NotificationType = notificationType;
     TaskName = taskName;
 }
Ejemplo n.º 19
0
 public NotificationModel(string message, ENotificationType notificationType)
 {
     Message          = message;
     NotificationType = notificationType;
 }