mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-04-22 18:15:47 +02:00
Fix notification timer stopping permanently when the screen is locked while a notification is visible
This commit is contained in:
parent
15d4ec3228
commit
697f4f1569
windows/TweetDuck
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using TweetDuck.Controls;
|
||||
using TweetDuck.Management;
|
||||
using TweetDuck.Utils;
|
||||
using TweetLib.Browser.Interfaces;
|
||||
@ -53,12 +54,12 @@ protected override bool CanDragWindow {
|
||||
}
|
||||
}
|
||||
|
||||
private void WindowsSessionManager_LockStateChanged(object? sender, EventArgs e) {
|
||||
if (WindowsSessionManager.IsLocked) {
|
||||
PauseNotification(NotificationPauseReason.WindowsSessionLocked);
|
||||
private void WindowsSessionManager_LockStateChanged(object? sender, bool isLocked) {
|
||||
if (isLocked) {
|
||||
this.InvokeAsyncSafe(() => PauseNotification(NotificationPauseReason.WindowsSessionLocked));
|
||||
}
|
||||
else {
|
||||
ResumeNotification(NotificationPauseReason.WindowsSessionLocked);
|
||||
this.InvokeAsyncSafe(() => ResumeNotification(NotificationPauseReason.WindowsSessionLocked));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,7 @@
|
||||
|
||||
namespace TweetDuck.Management {
|
||||
static class WindowsSessionManager {
|
||||
public static bool IsLocked { get; private set; } = false;
|
||||
public static event EventHandler? LockStateChanged;
|
||||
public static event EventHandler<bool>? LockStateChanged;
|
||||
|
||||
public static void Register() {
|
||||
Win.Application.ApplicationExit += OnApplicationExit;
|
||||
@ -27,8 +26,7 @@ private static void OnSessionSwitch(object? sender, SessionSwitchEventArgs e) {
|
||||
}
|
||||
|
||||
private static void SetLocked(bool newState) {
|
||||
IsLocked = newState;
|
||||
LockStateChanged?.Invoke(null, EventArgs.Empty);
|
||||
LockStateChanged?.Invoke(null, newState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user