if already visible, hide then show

ideally, we would stack multiple up each with its own timeout and close event. For now, this just makes a pop up for the new message.
This commit is contained in:
mshafer1
2024-12-20 15:53:22 -06:00
parent c8ba64f5d8
commit a8af6ce48e

View File

@@ -32,6 +32,10 @@ namespace ntfysh_client
public void ShowNotification(string title, string message, int timeout_ms = -1, ToolTipIcon? icon = null) public void ShowNotification(string title, string message, int timeout_ms = -1, ToolTipIcon? icon = null)
{ {
if (this.IsVisible)
{
this.handleTimeout(null, null);
}
this._icon = icon; this._icon = icon;
if (this._icon != null) if (this._icon != null)
{ {
@@ -83,7 +87,7 @@ namespace ntfysh_client
this.Left = workingleft - NotificationDialog.ScreenMargin; this.Left = workingleft - NotificationDialog.ScreenMargin;
} }
private void ui_hide_window(object? sender, EventArgs e) private void ui_hide_window(object? sender, EventArgs? e)
{ {
AnimateWindow( AnimateWindow(
this.Handle, this.Handle,
@@ -93,7 +97,7 @@ namespace ntfysh_client
this.IsVisible = false; this.IsVisible = false;
} }
private void handleTimeout(object? sender, EventArgs e) private void handleTimeout(object? sender, EventArgs? e)
{ {
if (this.timer != null) // check if the timer has already been disposed if (this.timer != null) // check if the timer has already been disposed
{ {