introduce theme files and handle in notification popup
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Windows.Forms;
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using ntfysh_client.Themes;
|
||||
|
||||
|
||||
namespace ntfysh_client
|
||||
@@ -21,6 +22,10 @@ namespace ntfysh_client
|
||||
private System.Windows.Forms.Timer? _updateTimer = null;
|
||||
private Stopwatch? _shownStopwatch = null;
|
||||
|
||||
private BaseTheme _darkModeTheme = new DarkModeTheme();
|
||||
private BaseTheme _defaultTheme = new DefaultTheme();
|
||||
private BaseTheme? _theme = null;
|
||||
|
||||
public NotificationDialog()
|
||||
{
|
||||
ShowInTaskbar = false;
|
||||
@@ -38,6 +43,17 @@ namespace ntfysh_client
|
||||
HandleTimeout(null, null);
|
||||
}
|
||||
|
||||
if(showInDarkMode)
|
||||
{
|
||||
_theme = _darkModeTheme;
|
||||
}
|
||||
else
|
||||
{
|
||||
_theme = _defaultTheme;
|
||||
}
|
||||
|
||||
ApplyTheme();
|
||||
|
||||
// setup data
|
||||
IconBox.Image = (icon is null) ? null : ConvertToolTipIconToImage(icon.Value);
|
||||
|
||||
@@ -95,6 +111,31 @@ namespace ntfysh_client
|
||||
SetWindowPosition();
|
||||
}
|
||||
|
||||
private void ApplyTheme()
|
||||
{
|
||||
if (_theme is null) _theme = _defaultTheme;
|
||||
|
||||
// back colors
|
||||
BackColor = _theme.BackgroundColor;
|
||||
TxBTitle.BackColor = _theme.BackgroundColor;
|
||||
TxBMessage.BackColor = _theme.BackgroundColor;
|
||||
LblTimeout.BackColor = _theme.BackgroundColor;
|
||||
ProgressBar1.BackColor = _theme.BackgroundColor;
|
||||
|
||||
// this one is not "hiding"
|
||||
ButtonClose.BackColor = _theme.ControlBackGroundColor;
|
||||
// handle mouse over
|
||||
ButtonClose.FlatAppearance.MouseOverBackColor = _theme.ControlMouseOverBackgroundColor;
|
||||
|
||||
// fore colors
|
||||
ForeColor = _theme.ForegroundColor;
|
||||
TxBTitle.ForeColor = _theme.ForegroundColor;
|
||||
TxBMessage.ForeColor = _theme.ForegroundColor;
|
||||
LblTimeout.ForeColor = _theme.ForegroundColor;
|
||||
ProgressBar1.ForeColor = _theme.ForegroundColor;
|
||||
ButtonClose.ForeColor = _theme.ForegroundColor;
|
||||
}
|
||||
|
||||
private void UpdateProgress(object? sender, EventArgs e)
|
||||
{
|
||||
if (_shownStopwatch is null) return;
|
||||
|
Reference in New Issue
Block a user