コード例 #1
0
        /// <summary>
        /// Manager on message queued.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The <see cref="NotificationMessageManagerEventArgs"/> instance containing the event data.</param>
        /// <exception cref="InvalidOperationException">Can't use both ItemsSource and Items collection at the same time.</exception>
        private void ManagerOnOnMessageQueued(object sender, NotificationMessageManagerEventArgs args)
        {
            (Items as AvaloniaList <object>).Add(args.Message);

            if (args.Message is INotificationAnimation animatableMessage &&
                animatableMessage.AnimatableElement != null)
            {
                var animation = animatableMessage.AnimationOut;
                animation.Delay    = TimeSpan.FromSeconds(0);
                animation.Duration = TimeSpan.FromSeconds(animatableMessage.AnimationOutDuration);

                Animatable animatable = animatableMessage.AnimatableElement as Animatable;
                animation.RunAsync(animatable);
            }
        }
コード例 #2
0
 /// <summary>
 /// Manager on message dismissed.
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="args">The <see cref="NotificationMessageManagerEventArgs"/> instance containing the event data.</param>
 /// <exception cref="InvalidOperationException">Can't use both ItemsSource and Items collection at the same time.</exception>
 private void ManagerOnOnMessageDismissed(object sender, NotificationMessageManagerEventArgs args)
 {
     RemoveMessage(args.Message);
 }