* UIForm: 右下角弹窗增加点击交互
This commit is contained in:
parent
225385b959
commit
6af3e1eec6
Binary file not shown.
Binary file not shown.
@ -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)
|
||||
|
@ -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实现
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
||||
/// <summary>
|
||||
|
10
SunnyUI/Forms/UINotifier.designer.cs
generated
10
SunnyUI/Forms/UINotifier.designer.cs
generated
@ -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";
|
||||
|
@ -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 一些辅助窗口
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user