using AntdUI; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace AntdUIDemo.Views { public partial class NotificationDemo : UserControl { private AntdUI.Window window; public NotificationDemo(AntdUI.Window _window) { window = _window; InitializeComponent(); BindEventHandler(); } private void BindEventHandler() { button_TR.Click += Button_Click; button_TL.Click += Button_Click; button_Top.Click += Button_Click; button_BR.Click += Button_Click; button_BL.Click += Button_Click; button_Bottom.Click += Button_Click; button_error.Click += Button_error_Click; button_info.Click += Button_info_Click; button_success.Click += Button_success_Click; button_warn.Click += Button_warn_Click; button_close.Click += Button_close_Click; button_link.Click += Button_link_Click; } private void Button_link_Click(object sender, EventArgs e) { AntdUI.Notification.open(new AntdUI.Notification.Config(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", TType.Info, TAlignFrom.TR) { CloseIcon = false, Link = new Notification.ConfigLink("Link to...", new Action(() => { AntdUI.Message.info(window, "Welcome!"); })) }); } private void Button_close_Click(object sender, EventArgs e) { AntdUI.Notification.open(new AntdUI.Notification.Config(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", TType.Info, TAlignFrom.TR) { CloseIcon = false, }); } private void Button_warn_Click(object sender, EventArgs e) { AntdUI.Notification.warn(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", autoClose: 3, align: TAlignFrom.TR); } private void Button_success_Click(object sender, EventArgs e) { AntdUI.Notification.success(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", autoClose: 3, align: TAlignFrom.TR); } private void Button_info_Click(object sender, EventArgs e) { AntdUI.Notification.info(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", autoClose: 3, align: TAlignFrom.TR); } private void Button_error_Click(object sender, EventArgs e) { AntdUI.Notification.error(window, "Notification Title", "This is the content of the notification. This is the content of the notification. This is the content of the notification.", autoClose: 3, align: TAlignFrom.TR); } private void Button_Click(object sender, EventArgs e) { var button = (AntdUI.Button)sender; var text = button.Text; var align = TAlignFrom.TR; switch (text) { case "TL": align = TAlignFrom.TL; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; case "TR": align = TAlignFrom.TR; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; case "Top": align = TAlignFrom.Top; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; case "BR": align = TAlignFrom.BR; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; case "BL": align = TAlignFrom.BL; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; case "Bottom": align = TAlignFrom.Bottom; AntdUI.Notification.info(window, $"Notification {align}", "Hello AntdUI Demo!", autoClose: 3, align: align); break; } } } }