internal virtual void SetToastData(ToastNotificationsViewModel toast) { toast.Title = Model.TargetChannel.Title; toast.Content = ToString(); toast.Navigator = Model; toast.TargetCharacter = null; }
public NotificationService(IChatState chatState, LoggingService loggingService, IHandleIcons iconService) { ChatState = chatState; events = chatState.EventAggregator; cm = chatState.ChatModel; characters = chatState.CharacterManager; icon = iconService; toast = new ToastNotificationsViewModel(chatState); ToastManager = new ToastService { AddNotification = notification => { Dispatcher.Invoke(() => cm.Notifications.Backlog(notification, 100)); loggingService.LogMessage("!Notifications", notification); }, ShowToast = toast.ShowNotifications, FlashWindow = () => Dispatcher.Invoke(FlashWindow), PlaySound = () => Dispatcher.Invoke(DingTheCrapOutOfTheUser), Toast = toast }; events.GetEvent <NewMessageEvent>().Subscribe(HandleNewChannelMessage, true); events.GetEvent <NewPmEvent>().Subscribe(HandleNewMessage, true); events.GetEvent <NewUpdateEvent>().Subscribe(HandleNotification, true); events.GetEvent <UnreadUpdatesEvent>().Subscribe(HandleUnreadUpdates, true); }
public NotificationService(IChatState chatState, LoggingService loggingService, IHandleIcons iconService) { ChatState = chatState; events = chatState.EventAggregator; cm = chatState.ChatModel; characters = chatState.CharacterManager; icon = iconService; toast = new ToastNotificationsViewModel(chatState); ToastManager = new ToastService { AddNotification = notification => { Dispatcher.Invoke(() => cm.Notifications.Backlog(notification, 100)); loggingService.LogMessage("!Notifications", notification); }, ShowToast = toast.ShowNotifications, FlashWindow = () => Dispatcher.Invoke(FlashWindow), PlaySound = () => Dispatcher.Invoke(DingTheCrapOutOfTheUser), Toast = toast }; events.GetEvent<NewMessageEvent>().Subscribe(HandleNewChannelMessage, true); events.GetEvent<NewPmEvent>().Subscribe(HandleNewMessage, true); events.GetEvent<NewUpdateEvent>().Subscribe(HandleNotification, true); events.GetEvent<UnreadUpdatesEvent>().Subscribe(HandleUnreadUpdates, true); }
internal virtual void SetToastData(ToastNotificationsViewModel toast) { var name = ApplicationSettings.ShowNamesInToasts ? Model.TargetCharacter.Name : "A user"; toast.Title = name; toast.Content = (ApplicationSettings.ShowAvatarsInToasts ? "" : name + " ") + ToString(); toast.TargetCharacter = Model.TargetCharacter; Model.TargetCharacter.GetAvatar(); toast.Navigator = Model; }
internal override void SetToastData(ToastNotificationsViewModel toast) { base.SetToastData(toast); toast.Title = $"{Model.TargetCharacter.Name} #{TargetChannel}"; }
internal virtual void SetToastData(ToastNotificationsViewModel toast) { var name = ApplicationSettings.ShowNamesInToasts ? Model.TargetCharacter.Name : "A user"; toast.Title = name; toast.Content = (ApplicationSettings.ShowAvatarsInToasts ? "" : name + " ") + ToString(); toast.TargetCharacter = Model.TargetCharacter; Model.TargetCharacter.GetAvatar(); toast.Navigator = Model; }
/// <summary> /// Initializes a new instance of the <see cref="NotificationService" /> class. /// </summary> /// <param name="eventagg"> /// The eventagg. /// </param> /// <param name="cm"> /// The cm. /// </param> /// <param name="manager"></param> public NotificationService(IEventAggregator eventagg, IChatModel cm, ICharacterManager manager) { events = eventagg; this.cm = cm; this.manager = manager; toast = new ToastNotificationsViewModel(events); events.GetEvent<NewMessageEvent>().Subscribe(HandleNewChannelMessage, true); events.GetEvent<NewPmEvent>().Subscribe(HandleNewMessage, true); events.GetEvent<NewUpdateEvent>().Subscribe(HandleNotification, true); events.GetEvent<CharacterSelectedLoginEvent>().Subscribe( args => { Application.Current.MainWindow.Closing += (s, e) => { e.Cancel = true; HideWindow(); }; Application.Current.MainWindow.MouseLeave += (s, e) => events.GetEvent<ErrorEvent>().Publish(null); this.cm.SelectedChannelChanged += (s, e) => events.GetEvent<ErrorEvent>().Publish(null); icon.Icon = new Icon(Environment.CurrentDirectory + @"\icons\catIcon.ico"); icon.DoubleClick += (s, e) => ShowWindow(); icon.BalloonTipClicked += (s, e) => { Settings.Default.ShowStillRunning = false; Settings.Default.Save(); }; var iconMenu = new ContextMenu(); iconMenu.MenuItems.Add( new MenuItem( string.Format( "{0} {1} ({2}) - {3}", Constants.ClientId, Constants.ClientName, Constants.ClientVer, args)) { Enabled = false }); iconMenu.MenuItems.Add(new MenuItem("-")); iconMenu.MenuItems.Add( new MenuItem("Sounds Enabled", ToggleSound) { Checked = ApplicationSettings.Volume > 0.0, }); iconMenu.MenuItems.Add( new MenuItem("Toasts Enabled", ToggleToast) { Checked = ApplicationSettings .ShowNotificationsGlobal }); iconMenu.MenuItems.Add(new MenuItem("-")); iconMenu.MenuItems.Add("Show", (s, e) => ShowWindow()); iconMenu.MenuItems.Add("Exit", (s, e) => ShutDown()); icon.Text = string.Format("{0} - {1}", Constants.ClientId, args); icon.ContextMenu = iconMenu; icon.Visible = true; }); }
internal override void SetToastData(ToastNotificationsViewModel toast) { base.SetToastData(toast); toast.Title = $"{Model.TargetCharacter.Name} #{TargetChannel}"; }
/// <summary> /// Initializes a new instance of the <see cref="NotificationsView" /> class. /// </summary> /// <param name="vm"> /// The vm. /// </param> public NotificationsView(ToastNotificationsViewModel vm) { InitializeComponent(); DataContext = vm; }
internal virtual void SetToastData(ToastNotificationsViewModel toast) { toast.Title = Model.TargetChannel.Title; toast.Content = ToString(); toast.Navigator = Model; toast.TargetCharacter = null; }
/// <summary> /// Initializes a new instance of the <see cref="NotificationsView" /> class. /// </summary> /// <param name="vm"> /// The vm. /// </param> public NotificationsView(ToastNotificationsViewModel vm) { InitializeComponent(); DataContext = vm; }