private void HideSimilarNotifications(HUDNotificationControl notificationControl) { for (var index = 0; index < this.stackPanelChildren.Count; index++) { var control = (HUDNotificationControl)this.stackPanelChildren[index]; if (control.IsSame(notificationControl)) { control.Hide(quick: true); } } }
private HUDNotificationControl ShowInternal( string title, string message, Brush brushBackground, Brush brushBorder, ITextureResource icon, Action onClick, bool autoHide, SoundResource soundToPlay) { Api.Logger.Important( string.Format( "Showing notification:{0}Title: {1}{0}Message: {2}", Environment.NewLine, title, message)); var notificationControl = HUDNotificationControl.Create( title, message, brushBackground, brushBorder, icon, onClick, autoHide, soundToPlay); this.HideSimilarNotifications(notificationControl); this.stackPanelChildren.Add(notificationControl); if (notificationControl.IsAutoHide) { // hide the notification control after delay ClientTimersSystem.AddAction( NotificationHideDelaySeconds, () => notificationControl.Hide(quick: false)); } this.HideOldNotificationsIfTooManyDisplayed(); return(notificationControl); }
public bool IsSame(HUDNotificationControl other) { return(this.ViewModel.IsSame(other.ViewModel)); }
public void Setup(HUDNotificationControl control, Func <bool> checker) { this.control = control; this.checker = checker; }