internal void PushNotifications(List<Objects.Notification> newNotifications, bool clearPrevious) { if (clearPrevious) { notificationTableLayoutPanel.Controls.Clear(); } foreach (var newNotification in newNotifications) { notificationTableLayoutPanel.RowStyles.Insert(0, new RowStyle(SizeType.AutoSize)); var notificationControl = new NotificationControl(); notificationControl.SetupScreen(newNotification); notificationControl.DismissNotification += notificationControl_DismissNotification; notificationControl.ReplyNotification += notificationControl_ReplyNotification; notificationTableLayoutPanel.Controls.Add(notificationControl); notificationTableLayoutPanel.SetCellPosition(notificationControl, new TableLayoutPanelCellPosition(0, 0)); } }
internal void PushNotifications(List<Objects.Notification> newNotifications, bool clearPrevious) { if (pushingNotifications) return; pushingNotifications = true; notificationsTabPage.Text = string.Format("Notifications ({0})", this.notifications.Count); int previouslySelectedIndex = filterComboBox.SelectedIndex; BindFilterCombo(); filterComboBox.SelectedIndex = previouslySelectedIndex; simpleViewControl.InitializeNotificationsCount(this.plugins, this.notifications); bool performLayout = clearPrevious; notificationTableLayoutPanel.SuspendLayout(); if (clearPrevious) { notificationTableLayoutPanel.Controls.Clear(); notificationTableLayoutPanel.RowStyles.Clear(); } var shownNotifications = (filterComboBox.Text.StartsWith("All (")) ? newNotifications : newNotifications.Where(x => filterComboBox.Text.StartsWith(x.ApplicationName + " (")); foreach (var newNotification in shownNotifications) { notificationTableLayoutPanel.RowStyles.Insert(0, new RowStyle(SizeType.AutoSize)); var notificationControl = new NotificationControl(); notificationControl.SetupScreen(newNotification); notificationControl.DismissNotification += notificationControl_DismissNotification; notificationControl.ReplyNotification += notificationControl_ReplayNotification; notificationTableLayoutPanel.Controls.Add(notificationControl); notificationTableLayoutPanel.SetCellPosition(notificationControl, new TableLayoutPanelCellPosition(0, 0)); performLayout = true; } notificationTableLayoutPanel.RowCount = this.notifications.Count; notificationTableLayoutPanel.ResumeLayout(); pushingNotifications = false; }
void notificationControl_ReplayNotification(object sender, NotificationControl.ReplayNotificationEventArgs e) { HandleGesture((Plugins.Gesture)e.Gesture); HandleSpeech(e.Speech); }
void notificationControl_DismissNotification(object sender, NotificationControl.DismissNotificationEventArgs e) { notifications.Remove(e.notification); PushNotifications(notifications, true); if (childForm != null) { childForm.update(); } }
void notificationControl_ReplyNotification(object sender, NotificationControl.ReplayNotificationEventArgs e) { //throw new NotImplementedException(); }
void notificationControl_DismissNotification(object sender, NotificationControl.DismissNotificationEventArgs e) { notifications.Remove(e.notification); PushNotifications(notifications, true); }