/// <summary> /// This method is used for show the toaster notification /// </summary> /// <param name="currentWindow"></param> /// <param name="notification"></param> public void ShowUINotification(Window currentWindow, NotificationUI notification) { try { notifier = new Notifier(cfg => { cfg.PositionProvider = new WindowPositionProvider(parentWindow: currentWindow, corner: Corner.TopRight, offsetX: Convert.ToInt32(ToasterSize.Ten), offsetY: Convert.ToInt32(ToasterSize.Ten)); cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor( notificationLifetime: TimeSpan.FromSeconds(Convert.ToInt32(ToasterSize.Three)), maximumNotificationCount: MaximumNotificationCount.FromCount(Convert.ToInt32(ToasterSize.Five))); cfg.Dispatcher = Application.Current.Dispatcher; }); MessageOptions messageOptions = new MessageOptions(); messageOptions.FontSize = Convert.ToInt32(ToasterSize.Fourteen); messageOptions.UnfreezeOnMouseLeave = true; if (notification.MessageType == "warning") { notifier.ShowWarning(notification.Message, messageOptions); } else if (notification.MessageType == "success") { notifier.ShowSuccess(notification.Message, messageOptions); } else if (notification.MessageType == "error") { notifier.ShowError(notification.Message, messageOptions); } } catch { throw; } }
public ToasterNotification() { NotificationUI = new NotificationUI(); }