diff --git a/Bin/net40/SunnyUI.Demo.exe b/Bin/net40/SunnyUI.Demo.exe index 62f7b457..b73437be 100644 Binary files a/Bin/net40/SunnyUI.Demo.exe and b/Bin/net40/SunnyUI.Demo.exe differ diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 050d0872..d40ea50c 100644 Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ diff --git a/SunnyUI.Demo/Forms/FDialogs.cs b/SunnyUI.Demo/Forms/FDialogs.cs index 961fa2e5..056888e2 100644 --- a/SunnyUI.Demo/Forms/FDialogs.cs +++ b/SunnyUI.Demo/Forms/FDialogs.cs @@ -109,7 +109,12 @@ namespace Sunny.UI.Demo private void uiSymbolButton2_Click(object sender, EventArgs e) { - ShowInfoNotifier("Info"); + ShowInfoNotifier("Info", InfoNotifierClick); + } + + private void InfoNotifierClick(object sender, EventArgs e) + { + ShowInfoTip("嗨,你点击了右下角的弹窗消息"); } private void uiSymbolButton6_Click(object sender, EventArgs e) diff --git a/SunnyUI/Forms/UIForm.cs b/SunnyUI/Forms/UIForm.cs index 1ac5b2a6..5d257945 100644 --- a/SunnyUI/Forms/UIForm.cs +++ b/SunnyUI/Forms/UIForm.cs @@ -1848,6 +1848,26 @@ namespace Sunny.UI UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, isDialog, timeout); } + public void ShowInfoNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.INFO, UILocalize.InfoTitle, timeout); + } + + public void ShowSuccessNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.OK, UILocalize.SuccessTitle, timeout); + } + + public void ShowWarningNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.WARNING, UILocalize.WarningTitle, timeout); + } + + public void ShowErrorNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.ERROR, UILocalize.ErrorTitle, timeout); + } + #endregion 一些辅助窗口 #region IFrame实现 diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs index 3d401834..f0790200 100644 --- a/SunnyUI/Forms/UIFormHelper.cs +++ b/SunnyUI/Forms/UIFormHelper.cs @@ -560,6 +560,11 @@ namespace Sunny.UI { UINotifier.Show(desc, type, title, isDialog, timeout, inApp); } + + public static void ShowNotifier(string desc, EventHandler clickEvent, UINotifierType type = UINotifierType.INFO, string title = "Notifier", int timeout = 0) + { + UINotifier.Show(desc, type, title, false, timeout, null, clickEvent); + } } public static class FormEx diff --git a/SunnyUI/Forms/UINotifier.cs b/SunnyUI/Forms/UINotifier.cs index 5fa0c27d..1002dc46 100644 --- a/SunnyUI/Forms/UINotifier.cs +++ b/SunnyUI/Forms/UINotifier.cs @@ -489,7 +489,7 @@ namespace Sunny.UI // Show the note: it is the startup of the creation process of the note //------------------------------------------------------------------------------------------------------------------------------- public static short Show(string desc, UINotifierType type = UINotifierType.INFO, string title = "Notifier", - bool isDialog = false, int timeout = 0, Form inApp = null) + bool isDialog = false, int timeout = 0, Form inApp = null, EventHandler clickevent = null) { if (NotifierAlreadyPresent(desc, type, title, isDialog, out var updated_note_id, out var updated_note_occurence)) { @@ -503,6 +503,8 @@ namespace Sunny.UI isDialog, timeout, inApp); + if (clickevent != null) + not.ItemClick = clickevent; not.SetDPIScale(); not.Show(); // Show the note @@ -753,6 +755,14 @@ namespace Sunny.UI { closeAllToolStripMenuItem.Text = UILocalize.CloseAll; } + + private void noteContent_Click(object sender, EventArgs e) + { + ItemClick?.Invoke(this, e); + Close(); + } + + public event EventHandler ItemClick; } // Close Class /// diff --git a/SunnyUI/Forms/UINotifier.designer.cs b/SunnyUI/Forms/UINotifier.designer.cs index 2c929385..56f0ceb2 100644 --- a/SunnyUI/Forms/UINotifier.designer.cs +++ b/SunnyUI/Forms/UINotifier.designer.cs @@ -56,6 +56,7 @@ this.noteContent.TabIndex = 3; this.noteContent.Text = "Description"; this.noteContent.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.noteContent.Click += new System.EventHandler(this.noteContent_Click); // // noteDate // @@ -64,7 +65,7 @@ this.noteDate.Image = global::Sunny.UI.Properties.Resources.notifier; this.noteDate.Location = new System.Drawing.Point(11, 97); this.noteDate.Name = "noteDate"; - this.noteDate.Size = new System.Drawing.Size(18, 15); + this.noteDate.Size = new System.Drawing.Size(13, 9); this.noteDate.TabIndex = 4; this.noteDate.Text = "- -"; // @@ -102,13 +103,13 @@ this.menu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.closeAllToolStripMenuItem}); this.menu.Name = "menu"; - this.menu.Size = new System.Drawing.Size(146, 34); + this.menu.Size = new System.Drawing.Size(120, 26); // // closeAllToolStripMenuItem // this.closeAllToolStripMenuItem.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.closeAllToolStripMenuItem.Name = "closeAllToolStripMenuItem"; - this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(145, 30); + this.closeAllToolStripMenuItem.Size = new System.Drawing.Size(119, 22); this.closeAllToolStripMenuItem.Text = "Close All"; this.closeAllToolStripMenuItem.Click += new System.EventHandler(this.onMenuCloseAllClick); // @@ -131,7 +132,7 @@ this.idLabel.Image = global::Sunny.UI.Properties.Resources.notifier; this.idLabel.Location = new System.Drawing.Point(296, 103); this.idLabel.Name = "idLabel"; - this.idLabel.Size = new System.Drawing.Size(35, 15); + this.idLabel.Size = new System.Drawing.Size(21, 9); this.idLabel.TabIndex = 7; this.idLabel.Text = "0000"; this.idLabel.Visible = false; @@ -140,7 +141,6 @@ // this.icon.BackColor = System.Drawing.Color.White; this.icon.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.icon.IsScaled = false; this.icon.Location = new System.Drawing.Point(10, 51); this.icon.MinimumSize = new System.Drawing.Size(1, 1); this.icon.Name = "icon"; diff --git a/SunnyUI/Frames/UIPage.cs b/SunnyUI/Frames/UIPage.cs index df8d5c1f..a72a8629 100644 --- a/SunnyUI/Frames/UIPage.cs +++ b/SunnyUI/Frames/UIPage.cs @@ -921,6 +921,26 @@ namespace Sunny.UI UINotifierHelper.ShowNotifier(desc, UINotifierType.ERROR, UILocalize.ErrorTitle, isDialog, timeout); } + public void ShowInfoNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.INFO, UILocalize.InfoTitle, timeout); + } + + public void ShowSuccessNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.OK, UILocalize.SuccessTitle, timeout); + } + + public void ShowWarningNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.WARNING, UILocalize.WarningTitle, timeout); + } + + public void ShowErrorNotifier(string desc, EventHandler clickEvent, int timeout = 2000) + { + UINotifierHelper.ShowNotifier(desc, clickEvent, UINotifierType.ERROR, UILocalize.ErrorTitle, timeout); + } + #endregion 一些辅助窗口 } } \ No newline at end of file