コード例 #1
0
        /// <summary>
        /// Sets the notification message background.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="backgroundBrush">The background brush.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Background(
            this NotificationMessageBuilder builder,
            IBrush backgroundBrush)
        {
            builder.SetBackground(backgroundBrush);

            return(builder);
        }
コード例 #2
0
        /// <summary>
        /// Sets the message header text.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="header">The header text.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder HasHeader(
            this NotificationMessageBuilder builder,
            string header)
        {
            builder.SetHeader(header);

            return(builder);
        }
コード例 #3
0
        /// <summary>
        /// Sets whether or not the message animates.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="animates">Whether or not the message should animate.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Animates(
            this NotificationMessageBuilder builder,
            bool animates)
        {
            builder.SetAnimates(animates);

            return(builder);
        }
コード例 #4
0
        /// <summary>
        /// Sets the badge text.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="badgeText">The badge text.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder HasBadge(
            this NotificationMessageBuilder builder,
            string badgeText)
        {
            builder.SetBadge(badgeText);

            return(builder);
        }
コード例 #5
0
        /// <summary>
        /// Sets the notification message accent.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="accentBrush">The accent brush.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Accent(
            this NotificationMessageBuilder builder,
            IBrush accentBrush)
        {
            builder.SetAccent(accentBrush);

            return(builder);
        }
コード例 #6
0
        /// <summary>
        /// Sets how long the message animates out (in seconds).
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="duration">How long the message should animate out (in seconds).</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder AnimationOutDuration(
            this NotificationMessageBuilder builder,
            double duration)
        {
            builder.SetAnimationOutDuration(duration);

            return(builder);
        }
コード例 #7
0
        /// <summary>
        /// Sets the message text.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="message">The message text.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder HasMessage(
            this NotificationMessageBuilder builder,
            string message)
        {
            builder.SetMessage(message);

            return(builder);
        }
コード例 #8
0
        /// <summary>
        /// Sets the notification message overlay.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="overlay">The overlay.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder WithOverlay(
            this NotificationMessageBuilder builder,
            object overlay)
        {
            builder.SetOverlay(overlay);

            return(builder);
        }
コード例 #9
0
        /// <summary>
        /// sets the max items to display
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="maxItems"></param>
        /// <returns></returns>
        public static NotificationMessageBuilder MaxItems(
            this NotificationMessageBuilder builder,
            int maxItems)
        {
            builder.SetMaxItems(maxItems);

            return(builder);
        }
コード例 #10
0
        /// <summary>
        /// Sets the notification message accent.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="accentBrush">The accent brush.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Accent(
            this NotificationMessageBuilder builder,
            string accentBrush)
        {
            var brush = new BrushConverter().ConvertFrom(accentBrush) as Brush;

            builder.SetAccent(brush);

            return(builder);
        }
コード例 #11
0
        /// <summary>
        /// Sets the notification message background.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="backgroundBrush">The background brush.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Background(
            this NotificationMessageBuilder builder,
            string backgroundBrush)
        {
            var brush = new BrushConverter().ConvertFrom(backgroundBrush) as IBrush;

            builder.SetBackground(brush);

            return(builder);
        }
コード例 #12
0
        /// <summary>
        /// Sets the foreground brush.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="foregroundBrush">The foreground brush.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder Foreground(
            this NotificationMessageBuilder builder,
            string foregroundBrush)
        {
            var brush = new BrushConverter().ConvertFrom(foregroundBrush) as Brush;

            builder.SetForeground(brush);

            return(builder);
        }
コード例 #13
0
 /// <summary>
 /// Attached the dismiss action before callback action.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <param name="callback">The callback.</param>
 /// <returns>
 /// Returns the action that will call manager dismiss for notification
 /// message in builder when button is clicked and then call the callback action.
 /// </returns>
 private static Action <INotificationMessageButton> DismissBefore(
     this NotificationMessageBuilder builder,
     Action <INotificationMessageButton> callback)
 {
     return(button =>
     {
         builder.Manager.Dismiss(builder.Message);
         callback?.Invoke(button);
     });
 }
コード例 #14
0
        /// <summary>
        /// Creates the message.
        /// </summary>
        /// <param name="manager">The manager.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder CreateMessage(
            this INotificationMessageManager manager)
        {
            var builder = NotificationMessageBuilder.CreateMessage();

            builder.Manager = manager;
            builder.Message = manager.Factory.GetMessage();

            return(builder);
        }
コード例 #15
0
        /// <summary>
        /// Adds the button to the notification message.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="content">The content.</param>
        /// <param name="callback">The callback.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder WithButton(
            this NotificationMessageBuilder builder,
            object content,
            Action <INotificationMessageButton> callback)
        {
            var button = builder.Manager.Factory.GetButton();

            button.Callback = callback;
            button.Content  = content;

            builder.AddButton(button);

            return(builder);
        }
コード例 #16
0
        /// <summary>
        /// Sets the notification message top additional content.
        /// </summary>
        /// <param name="builder">The builder.</param>
        /// <param name="additionalContent">The additional content.</param>
        /// <param name="contentLocation">The location of the content.</param>
        /// <returns>Returns the notification message builder.</returns>
        public static NotificationMessageBuilder WithAdditionalContent(
            this NotificationMessageBuilder builder,
            ContentLocation contentLocation,
            object additionalContent)
        {
            switch (contentLocation)
            {
            case ContentLocation.Top:
            {
                builder.SetAdditionalContentTop(additionalContent);
                break;
            }

            case ContentLocation.Bottom:
            {
                builder.SetAdditionalContentBottom(additionalContent);
                break;
            }

            case ContentLocation.Left:
            {
                builder.SetAdditionalContentLeft(additionalContent);
                break;
            }

            case ContentLocation.Right:
            {
                builder.SetAdditionalContentRight(additionalContent);
                break;
            }

            case ContentLocation.Main:
            {
                builder.SetAdditionalContentMain(additionalContent);
                break;
            }

            case ContentLocation.AboveBadge:
            {
                builder.SetAdditionalContentOverBadge(additionalContent);
                break;
            }

            default:
            { break; }
            }

            return(builder);
        }
コード例 #17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DismissNotificationMessage"/> class.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <exception cref="ArgumentNullException">builder</exception>
 public DismissNotificationMessage(NotificationMessageBuilder builder)
 {
     Builder = builder ?? throw new ArgumentNullException(nameof(builder));
 }
コード例 #18
0
 /// <summary>
 /// Marks next button to be dismiss.
 /// This button will dismiss the notification message when clicked.
 /// </summary>
 /// <param name="builder">The builder.</param>
 /// <returns>Returns the notification message builder.</returns>
 public static NotificationMessageBuilder.DismissNotificationMessage Dismiss(
     this NotificationMessageBuilder builder)
 {
     return(new NotificationMessageBuilder.DismissNotificationMessage(builder));
 }