utilize modern c# features
This commit is contained in:
@@ -119,10 +119,7 @@ namespace ntfysh_client
|
|||||||
|
|
||||||
private void UpdateProgress(object? sender, EventArgs e)
|
private void UpdateProgress(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (_shownStopwatch == null)
|
if (_shownStopwatch is null) 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}";
|
||||||
@@ -146,11 +143,6 @@ namespace ntfysh_client
|
|||||||
base.SetVisibleCore(value);
|
base.SetVisibleCore(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnShown(EventArgs e)
|
|
||||||
{
|
|
||||||
base.OnShown(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SetWindowPosition()
|
private void SetWindowPosition()
|
||||||
{
|
{
|
||||||
int workingtop = Screen.PrimaryScreen.WorkingArea.Height - Height;
|
int workingtop = Screen.PrimaryScreen.WorkingArea.Height - Height;
|
||||||
@@ -188,21 +180,13 @@ namespace ntfysh_client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Image? ConvertToolTipIconToImage(ToolTipIcon icon)
|
private Image? ConvertToolTipIconToImage(ToolTipIcon icon) => icon switch
|
||||||
{
|
{
|
||||||
switch (icon)
|
ToolTipIcon.Info => SystemIcons.Information.ToBitmap(),
|
||||||
{
|
ToolTipIcon.Warning => SystemIcons.Warning.ToBitmap(),
|
||||||
case ToolTipIcon.Info:
|
ToolTipIcon.Error => SystemIcons.Error.ToBitmap(),
|
||||||
return SystemIcons.Information.ToBitmap();
|
_ => null
|
||||||
case ToolTipIcon.Warning:
|
};
|
||||||
return SystemIcons.Warning.ToBitmap();
|
|
||||||
case ToolTipIcon.Error:
|
|
||||||
return SystemIcons.Error.ToBitmap();
|
|
||||||
case ToolTipIcon.None:
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void InitializeWindowHidden()
|
private void InitializeWindowHidden()
|
||||||
{
|
{
|
||||||
@@ -231,10 +215,7 @@ namespace ntfysh_client
|
|||||||
public const int AW_BLEND = 0x00080000;
|
public const int AW_BLEND = 0x00080000;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void window_MouseDown(object sender, EventArgs e)
|
private void window_MouseDown(object sender, EventArgs e) => CancelTimer();
|
||||||
{
|
|
||||||
CancelTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CancelTimer()
|
private void CancelTimer()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user