Example #1
0
        /// <summary>Displays the toast.</summary>
        /// <param name="type">The type.</param>
        /// <param name="message">The message.</param>
        /// <param name="date">The date.</param>
        private static void DisplayToast(string type, string message, DateTime date)
        {
            //Creates a new notification manager
            Notifications.Wpf.NotificationManager notificationManager = new Notifications.Wpf.NotificationManager();

            //Shows the notification with the given data
            notificationManager.Show(new NotificationContent
            {
                Title   = type,
                Message = message + " " + date.ToString("d"),
                Type    = NotificationType.Information
            });
        }
Example #2
0
        public Notifier(Config.Config config)
        {
            _manager = new Notifications.Wpf.NotificationManager();

            Color?backColor = Config.Config.Parse(config.BackgroundColorString);
            Color?fontColor = Config.Config.Parse(config.FontColorString);

            if (backColor.HasValue == false)
            {
                backColor = Colors.Orange;
            }

            if (fontColor.HasValue == false)
            {
                fontColor = Colors.White;
            }

            _notification = new Notification(backColor.Value, fontColor.Value);
        }
Example #3
0
        /// <summary>
        /// Creates notification manater.
        /// </summary>
        /// <param name="notificationMax">Notification max.</param>
        /// <param name="historyMax">History max.</param>
        /// <param name="dispatcher">Notification dispatcher.</param>
        /// <param name="notificationAreaName">Notification area name.</param>
        public NotificationManager(int notificationMax, int historyMax, Dispatcher dispatcher, string notificationAreaName)
        {
            this.NotificationMax = Math.Max(Math.Min(notificationMax, NOTIFICATION_MAX), NOTIFICATION_MIN);
            this.HistoryMax      = Math.Max(Math.Min(historyMax, HISTORY_MAX), HISTORY_MIN);

            this.dispatcher = dispatcher;

            if (this.NotificationMax > 0 && dispatcher != null)
            {
                this.notification = new Notifications.Wpf.NotificationManager(dispatcher);
                this.areaName     = notificationAreaName;
            }

            if (this.HistoryMax > 0)
            {
                this.HistoryTable = new DataTable();

                var colomns = this.HistoryTable.Columns;

                colomns.Add(LocalizedInfo.DataGridDateTime);
                colomns.Add(LocalizedInfo.DataGridLevel);
                colomns.Add(LocalizedInfo.DataGridMessage);
            }
        }