Ejemplo n.º 1
0
 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);
         }
     }
 }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public bool IsSame(HUDNotificationControl other)
 {
     return(this.ViewModel.IsSame(other.ViewModel));
 }
Ejemplo n.º 4
0
 public void Setup(HUDNotificationControl control, Func <bool> checker)
 {
     this.control = control;
     this.checker = checker;
 }