Ejemplo n.º 1
0
        /// <summary>
        /// Closes this notification panel instance.
        /// </summary>
        public void Close()
        {
            foreach (Control control in tableLayoutPanel.Controls)
            {
                NotifyBanner banner = control as NotifyBanner;
                if (banner == null)
                {
                    continue;
                }

                banner.Close();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sends a banner notification (with 3 custom actions) to be displayed at the top of the application notification panel.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="closeText">The close text (defaults to OK).</param>
        /// <param name="action1Text">First action text.</param>
        /// <param name="action1">First action.</param>
        /// <param name="action2Text">Second action text.</param>
        /// <param name="action2">Second action.</param>
        /// <param name="action3Text">Third action text.</param>
        /// <param name="action3">Third action.</param>
        /// <returns></returns>
        public static NotifyBanner Banner(string message, string closeText, string action1Text, Action action1, string action2Text, Action action2, string action3Text, Action action3)
        {
            Form mainForm = null;

            if (Application.OpenForms.Count > 0)
            {
                mainForm = Application.OpenForms[0];
            }

            NotifyBanner banner = null;

            UIUtility.Invoke(mainForm, () =>
            {
                EventHandler <NotifyBannerEventArgs> bannerNotified = Instance.BannerNotified;

                if (bannerNotified == null)
                {
                    return;
                }

                banner           = new NotifyBanner();
                banner.Message   = message;
                banner.CloseText = closeText;

                if (!String.IsNullOrEmpty(action1Text))
                {
                    banner.AddAction(action1Text, action1);
                }

                if (!String.IsNullOrEmpty(action2Text))
                {
                    banner.AddAction(action2Text, action2);
                }

                if (!String.IsNullOrEmpty(action3Text))
                {
                    banner.AddAction(action3Text, action3);
                }

                bannerNotified(Instance, new NotifyBannerEventArgs(banner));
            });

            return(banner);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Sends a banner notification to be displayed at the top of the application notification panel.
        /// </summary>
        /// <param name="banner">The pre-constructed banner.</param>
        public static void Banner(NotifyBanner banner)
        {
            Form mainForm = null;

            if (Application.OpenForms.Count > 0)
            {
                mainForm = Application.OpenForms[0];
            }

            UIUtility.Invoke(mainForm, () =>
            {
                EventHandler <NotifyBannerEventArgs> bannerNotified = Instance.BannerNotified;

                if (bannerNotified == null)
                {
                    return;
                }

                bannerNotified(Instance, new NotifyBannerEventArgs(banner));
            });
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Sends a banner notification (with 2 custom actions) to be displayed at the top of the application notification panel.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="closeText">The close text (defaults to OK).</param>
        /// <param name="action1Text">First action text.</param>
        /// <param name="action1">First action.</param>
        /// <param name="action2Text">Second action text.</param>
        /// <param name="action2">Second action.</param>
        /// <returns></returns>
        public static NotifyBanner Banner(string message, string closeText, string action1Text, Action action1, string action2Text, Action action2)
        {
            NotifyBanner banner = Banner(message, closeText, action1Text, action1, action2Text, action2);

            return(banner);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Sends a banner notification to be displayed at the top of the application notification panel.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="closeText">The close text (defaults to OK).</param>
        /// <param name="actionText">The action text if providing an interactive button for the user to respond.</param>
        /// <param name="action">The custom action when the action button is clicked.</param>
        /// <returns></returns>
        public static NotifyBanner Banner(string message, string closeText = "", string actionText = "", Action action = null)
        {
            NotifyBanner banner = Banner(message, closeText, actionText, action);

            return(banner);
        }
 public NotifyBannerEventArgs(NotifyBanner banner) :
     base()
 {
     Banner = banner;
 }