add blank lines for readability

This commit is contained in:
mshafer1
2024-12-21 08:03:23 -06:00
parent 934edb79eb
commit fa455baa57
2 changed files with 19 additions and 1 deletions

View File

@@ -79,6 +79,7 @@ namespace ntfysh_client
} }
else else
{ {
_notificationDialog.ShowNotification( _notificationDialog.ShowNotification(
title: finalTitle, title: finalTitle,
message: e.Message, message: e.Message,
@@ -341,6 +342,8 @@ namespace ntfysh_client
older.ReconnectAttempts = newer.ReconnectAttempts; older.ReconnectAttempts = newer.ReconnectAttempts;
older.ReconnectAttemptDelay = newer.ReconnectAttemptDelay; older.ReconnectAttemptDelay = newer.ReconnectAttemptDelay;
} }
//Apply settings introduced in Revision 2 (Native vs custom notifications)
if (older.Revision < 2) if (older.Revision < 2)
{ {
older.UseNativeWindowsNotifications = newer.UseNativeWindowsNotifications; older.UseNativeWindowsNotifications = newer.UseNativeWindowsNotifications;

View File

@@ -54,12 +54,15 @@ namespace ntfysh_client
// close the current notification // close the current notification
handleTimeout(null, null); handleTimeout(null, null);
} }
// setup data // setup data
_icon = icon; _icon = icon;
if (_icon != null) if (_icon != null)
{ {
iconBox.Image = ConvertToolTipIconToImage(_icon.Value); iconBox.Image = ConvertToolTipIconToImage(_icon.Value);
} }
tbTitle.Text = title; tbTitle.Text = title;
tbMessage.Text = message; tbMessage.Text = message;
@@ -69,11 +72,13 @@ namespace ntfysh_client
_displayTimeoutTimer.Stop(); _displayTimeoutTimer.Stop();
_displayTimeoutTimer.Dispose(); _displayTimeoutTimer.Dispose();
} }
if (_updateTimer != null) if (_updateTimer != null)
{ {
_updateTimer.Stop(); _updateTimer.Stop();
_updateTimer.Dispose(); _updateTimer.Dispose();
} }
if (timeout_ms > 0) if (timeout_ms > 0)
{ {
_displayTimeoutTimer = new System.Timers.Timer(timeout_ms); _displayTimeoutTimer = new System.Timers.Timer(timeout_ms);
@@ -94,7 +99,8 @@ namespace ntfysh_client
progressBar1.Visible = true; progressBar1.Visible = true;
lbTimeout.Visible = true; lbTimeout.Visible = true;
_timeout = timeout_ms; _timeout = timeout_ms;
} else }
else
{ {
progressBar1.Visible = false; progressBar1.Visible = false;
lbTimeout.Visible = false; lbTimeout.Visible = false;
@@ -117,6 +123,7 @@ namespace ntfysh_client
{ {
return; return;
} }
progress = (int)((_timeout - _shownStopwatch.ElapsedMilliseconds) * 100 / _timeout); progress = (int)((_timeout - _shownStopwatch.ElapsedMilliseconds) * 100 / _timeout);
lbTimeout.Text = $"{(int)(_timeout - _shownStopwatch.ElapsedMilliseconds) / 1000}"; lbTimeout.Text = $"{(int)(_timeout - _shownStopwatch.ElapsedMilliseconds) / 1000}";
} }
@@ -124,15 +131,18 @@ namespace ntfysh_client
protected override void SetVisibleCore(bool value) protected override void SetVisibleCore(bool value)
{ {
SetWindowPosition(); SetWindowPosition();
if (value) if (value)
{ {
BringToFront(); BringToFront();
AnimateWindow( AnimateWindow(
Handle, Handle,
time: 250, time: 250,
flags: NFWinUserAnimateWindowConstnats.AW_SLIDE | NFWinUserAnimateWindowConstnats.AW_VER_NEGATIVE flags: NFWinUserAnimateWindowConstnats.AW_SLIDE | NFWinUserAnimateWindowConstnats.AW_VER_NEGATIVE
); );
} }
base.SetVisibleCore(value); base.SetVisibleCore(value);
} }
@@ -152,17 +162,20 @@ namespace ntfysh_client
private void ui_hide_window(object? sender, EventArgs? e) private void ui_hide_window(object? sender, EventArgs? e)
{ {
AnimateWindow( AnimateWindow(
Handle, Handle,
time: 250, time: 250,
flags: NFWinUserAnimateWindowConstnats.AW_SLIDE | NFWinUserAnimateWindowConstnats.AW_VER_POSITIVE | NFWinUserAnimateWindowConstnats.AW_HIDE flags: NFWinUserAnimateWindowConstnats.AW_SLIDE | NFWinUserAnimateWindowConstnats.AW_VER_POSITIVE | NFWinUserAnimateWindowConstnats.AW_HIDE
); );
IsVisible = false; IsVisible = false;
} }
private void handleTimeout(object? sender, EventArgs? e) private void handleTimeout(object? sender, EventArgs? e)
{ {
cancelTimer(); cancelTimer();
if (InvokeRequired) if (InvokeRequired)
{ {
// on a background thread, so invoke on the UI thread // on a background thread, so invoke on the UI thread
@@ -247,12 +260,14 @@ namespace ntfysh_client
_displayTimeoutTimer.Dispose(); _displayTimeoutTimer.Dispose();
_displayTimeoutTimer = null; _displayTimeoutTimer = null;
} }
if (_updateTimer != null) if (_updateTimer != null)
{ {
_updateTimer.Stop(); _updateTimer.Stop();
_updateTimer.Dispose(); _updateTimer.Dispose();
_updateTimer = null; _updateTimer = null;
} }
if (_shownStopwatch != null) if (_shownStopwatch != null)
{ {
_shownStopwatch.Stop(); _shownStopwatch.Stop();