private void HandleNewNotification(Notification notification) { List<Notification> notifications = (List<Notification>) ListNotifications.ItemsSource; if(notifications != null) notifications.Insert(0, notification); ListNotifications.ItemsSource = notifications; int count = historyService.CountUnreadNotifications(); if (count == 0) { if (ToolBar.ColumnDefinitions.Count == 3) ToolBar.ColumnDefinitions[3].Width = new GridLength(64); CountLabel.Visibility = System.Windows.Visibility.Collapsed; CountLabel.Text = ""; } else { if(ToolBar.ColumnDefinitions.Count == 3) ToolBar.ColumnDefinitions[3].Width = new GridLength(94); CountLabel.Visibility = System.Windows.Visibility.Visible; CountLabel.Text = Convert.ToString(count); } }
public Model() { phoneStorage = new IOStorage(); nc = App.Current.GetApplicationNotificationObject(); // create a new delegate (OnImageChanged) and assign it. webHandlerMethod = new webResponseHandler(this.OnImageChanged); }
/// <summary> /// /// </summary> public void Push(Notification notification) { notification.SetViewCommand(); Notification old = notifications.FirstOrDefault(n => n.Category == notification.Category); if (old != null) notifications.Remove(old); notifications.Add(notification); }
private void NotificationTypesList_SelectionChanged(object sender, SelectionChangedEventArgs e) { Notification notification = new Notification(); notification.Contact = contact; Messenger.Default.Send<Notification>(notification); NavigationService.GoBack(); }
public void ExecuteAlertForNotification(Notification notification, bool withSound) { VibrateController vibrateController = VibrateController.Default; vibrateController.Start(TimeSpan.FromSeconds(1)); if (withSound) { Stream soundStream = Application.GetResourceStream(new Uri("Assets/Audio/ow.wav", UriKind.Relative)).Stream; SoundEffectInstance Sound = SoundEffect.FromStream(soundStream).CreateInstance(); Sound.Play(); while (Sound.State == SoundState.Playing) { } switch (notification.Type) { case 1: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/vamo.wav", UriKind.Relative)).Stream; break; case 2: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/perai.wav", UriKind.Relative)).Stream; break; case 3: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/chegou.wav", UriKind.Relative)).Stream; break; case 4: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/maneiro.wav", UriKind.Relative)).Stream; break; case 5: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/tocomfome.wav", UriKind.Relative)).Stream; break; case 6: soundStream = Application.GetResourceStream(new Uri("Assets/Audio/owkey.wav", UriKind.Relative)).Stream; break; } Sound = SoundEffect.FromStream(soundStream).CreateInstance(); Sound.Play(); } ShellToast toast = new ShellToast(); toast.Title = "Ow"; toast.Content = String.Format(AppResources.NotificationMessage, notification.Contact.FirstName, notification.TypeToString()); toast.Show(); }
public void AddNotification(Notification notification) { if (currentNotifications.Count + 1 > MAX_NOTIFICATIONS) buffer.Add(notification); else currentNotifications.Add(notification); //Show window if there're notifications if (currentNotifications.Count > 0 && !IsActive) Show(); }
public void notify(Notification notification) { filterNotification(notification); var notificationViewModel = new NotificationViewModel(notification); var notificationWindow = new NotificationWindow(notificationViewModel); var screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; var screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; var nHeight = notificationWindow.Height; var nWidth = notificationWindow.Width; var notificationSpot = -1; for (int i = 0; i < _maxNumNotifications; ++i) { if (_availableNotificationSpots[i]) { notificationSpot = i; break; } } if(notificationSpot == -1) { for (int i = 0; i < _maxNumNotifications; ++i) { _availableNotificationSpots[i] = true; } notificationSpot = 0; } notificationWindow.Left = screenWidth - nWidth - _rightOffset; notificationWindow.Top = _topOffset + notificationSpot * 90; notificationWindow.Opacity = 0; notificationWindow.Show(); _availableNotificationSpots[notificationSpot] = false; var showAnimation = new DoubleAnimation(0, 1, (Duration)_fadeInDuration); showAnimation.Completed += (s1, e1) => { var waitAnimation = new DoubleAnimation(1, _displayDuration); waitAnimation.Completed += (s2, e2) => { var hideAnimation = new DoubleAnimation(0, (Duration)_fadeOutDuration); hideAnimation.Completed += (s3, e3) => { notificationWindow.Hide(); notificationWindow.Close(); _availableNotificationSpots[notificationSpot] = true; }; notificationWindow.BeginAnimation(UIElement.OpacityProperty, hideAnimation); }; notificationWindow.BeginAnimation(UIElement.OpacityProperty, waitAnimation); }; notificationWindow.BeginAnimation(UIElement.OpacityProperty, showAnimation); }
/// <summary> /// Adds a notification to the queue, and display it if applicable. /// </summary> /// <param name="notification">Notification to add</param> public void AddNotification( Notification notification ) { notification.Id = count++; if( Notifications.Count + 1 > MAX_NOTIFICATIONS ) buffer.Add( notification ); else Notifications.Add( notification ); //Show window if there're notifications if( Notifications.Count > 0 ) this.Visibility = System.Windows.Visibility.Visible; }
public void RemoveNotification(Notification notification) { if (Notifications.Contains(notification)) Notifications.Remove(notification); if (buffer.Count <= 0) return; Notifications.Add(buffer[0]); buffer.RemoveAt(0); //Close window if there's nothing to show if (Notifications.Count < 1 && IsActive) Close(); }
/// <summary> /// Removes a notification from the queue, clearing it. /// </summary> /// <param name="notification">Notification to remove.</param> public void RemoveNotification( Notification notification ) { if( Notifications.Contains( notification ) ) Notifications.Remove( notification ); if( buffer.Count > 0 ) { Notifications.Add( buffer[0] ); buffer.RemoveAt( 0 ); } //Close window if there's nothing to show if( Notifications.Count < 1 ) this.Visibility = System.Windows.Visibility.Collapsed; }
public void RemoveNotification(Notification notification) { if (currentNotifications.Contains(notification)) currentNotifications.Remove(notification); if (buffer.Count > 0) { currentNotifications.Add(buffer[0]); buffer.RemoveAt(0); } //Close window if there's nothing to show if (currentNotifications.Count < 1) Hide(); }
public void AddNotification(Notification notification) { notification.Id = count++; if (Notifications.Count + 1 > MAX_NOTIFICATIONS) buffer.Add(notification); else Notifications.Add(notification); //Show window if there're notifications if (Notifications.Count > 0 && !IsActive) Show(); //playNotificationSound(); }
public void AddNotification(Notification notification) { Dispatcher.InvokeAsync(() => { notification.Id = count++; if (Notifications.Count + 1 > startupConfiguration.MaxNotifications) buffer.Add(notification); else Notifications.Add(notification); if (Notifications.Count > 0 && !IsActive) Show(); }, DispatcherPriority.Background); }
public void AddNotification(Notification notification) { notification.Id = _count++; if (_notifications.Count + 1 > MaxNotifications) { _notificationsBuffer.Add(notification); } else { _notifications.Add(notification); } // Show window if there're notifications if (_notifications.Count > 0 && !IsActive) { Show(); } }
public void AddNotification(Notification notification) { if (this.notifications.Count + 1 > MaxNotifications) { this.buffer.Add(notification); } else { this.notifications.Add(notification); } if (this.notifications.Count > 0 && !this.IsActive) { this.Show(); } }
public void AddNotification(Notification notification) { notification.Id = count++; if (notifications.Count + 1 > MAX_NOTIFICATIONS) buffer.Add(notification); else notifications.Add(notification); //Show window if there're notifications this.Dispatcher.Invoke(new Action(() => { if (notifications.Count > 0 && !IsActive) Show(); })); }
public void RemoveNotification(Notification notification) { if (_notifications.Contains(notification)) { _notifications.Remove(notification); } if (_notificationsBuffer.Count > 0) { _notifications.Add(_notificationsBuffer[0]); _notificationsBuffer.RemoveAt(0); } //Close window if there's nothing to show if (_notifications.Count < 1) { Hide(); } }
public void RemoveNotification(Notification notification) { if (this.notifications.Contains(notification)) { this.notifications.Remove(notification); } if (this.buffer.Count > 0) { this.notifications.Add(this.buffer[0]); this.buffer.RemoveAt(0); } if (this.notifications.Count < 1) { this.Hide(); } }
public void RemoveNotification(Notification notification) { Dispatcher.InvokeAsync(() => { if (Notifications.Contains(notification)) Notifications.Remove(notification); if (buffer.Count > 0) { Notifications.Add(buffer[0]); buffer.RemoveAt(0); } if (Notifications.Count < 1) { Hide(); OnDispose.InvokeSafely(this, new EventArgs()); } }, DispatcherPriority.Background); }
public MainWindow() { InitializeComponent(); label3.Content = Convert.ToString(ApplicationState.GetValue<int>("currentPoints")); /*initialize program variables*/ var optionIddleTime = new TimeSpan(0, 0, 0, 5); ApplicationState.SetValue("optionExpertMode", true); /*options*/ ApplicationState.SetValue("optionLock", true); ApplicationState.SetValue("optionIddleTime", optionIddleTime); ApplicationState.SetValue("optionActive", false); /*current points */ ApplicationState.SetValue("currentPoints", 23); /*windows events*/ SystemEvents.SessionSwitch += SystemEventsSessionSwitch; /*initialize tray icon*/ var ni = new NotifyIcon { Icon = new Icon( @"C:\Users\Alejandro Garcia\TimeToBreak\TimeToBreak\TimeToBreak\images\Social-graph.ico"), Visible = true }; ni.DoubleClick += NiDoubleClick; ni.MouseDown += NiMouseDown; var noti = new Notification(tb); //noti.StartNotifying(15); ApplicationState.SetValue("notification", noti); Timer2.Tick += new EventHandler(Timer2_Tick); Timer2.Interval = TimeSpan.FromSeconds(2); Timer2.Start(); }
private void RaiseNewNotification( string title = "Notification", string message = "", string imageUri = null ) { Notification n = new Notification() { Title = title, Message = message, ImageUrl = imageUri }; RaiseNewNotification( n ); }
private void RaiseNewNotification( Notification n ) { if( _hideNotifications ) return; var h = NewNotification; if( h != null ) h( this, new NotificationEventArgs( n ) ); }
private void ActiveClick(object sender, RoutedEventArgs e) { if (ApplicationState.GetValue<bool>("optionActive")) { ApplicationState.SetValue("optionActive", false); activeMenu.IsChecked = false; var n = ApplicationState.GetValue<Notification>("notification"); n.StopNotifying(); } else { ApplicationState.SetValue("optionActive", true); activeMenu.IsChecked = true; var noti = new Notification(tb); noti.StartNotifying(Convert.ToInt32(ApplicationState.GetValue<TimeSpan>("optionIddleTime").TotalSeconds)); ApplicationState.SetValue("notification", noti); } }
/// <summary> /// Thread Safe /// </summary> /// <param name="notification"></param> public void ShowNotification(Notification notification) { notificationWindow.Dispatcher.Invoke(new Action(() => notificationWindow.AddNotification(notification))); }
public virtual void DeleteNotification(Notification notForDelete) { ClarolineDB.Notifications_Table.DeleteOnSubmit(notForDelete); SaveChangesToDB(); }
public virtual void AddNotification(Notification newNot, ResourceModel attachedResource) { using (ClarolineDataContext cdc = new ClarolineDataContext(ClarolineDataContext.DBConnectionString)) { Notification lastNotificationFromDB = cdc.Notifications_Table.OrderByDescending(n => n.date) .FirstOrDefault(n => n.resource == newNot.resource); if (lastNotificationFromDB != null) { if (lastNotificationFromDB.date.CompareTo(newNot.date) >= 0) { return; } } newNot.resource = cdc.Resources_Table.Single(r => r.Id == attachedResource.Id); cdc.Notifications_Table.InsertOnSubmit(newNot); cdc.SubmitChanges(); } }
private void RefreshingStarted(Notification notification) { this.SetIsRefreshing(true); }
private void filterNotification(Notification notification) { notification.Title = notification.Title.Trim(); notification.Subtitle = notification.Subtitle.Trim(); notification.Description = notification.Description.Trim(); }
private void RefreshingEnded(Notification notification) { this.SetIsRefreshing(false); }
private void UpdateRunningVmCount(Notification notification) { int count = (int)notification.UserInfo["count"]; if (count > 0) { //TODO: show running vm count? _NotifyIcon.Icon = Icon.FromHandle(Resources.vagrant_logo_on.GetHicon()); } else { _NotifyIcon.Icon = Icon.FromHandle(Resources.vagrant_logo_off.GetHicon()); } }