mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-01 08:34:11 +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.Collections.Generic;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using TweetDuck.Controls;
|
||||||
using TweetDuck.Management;
|
using TweetDuck.Management;
|
||||||
using TweetDuck.Utils;
|
using TweetDuck.Utils;
|
||||||
using TweetLib.Browser.Interfaces;
|
using TweetLib.Browser.Interfaces;
|
||||||
@ -53,12 +54,12 @@ protected override bool CanDragWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowsSessionManager_LockStateChanged(object? sender, EventArgs e) {
|
private void WindowsSessionManager_LockStateChanged(object? sender, bool isLocked) {
|
||||||
if (WindowsSessionManager.IsLocked) {
|
if (isLocked) {
|
||||||
PauseNotification(NotificationPauseReason.WindowsSessionLocked);
|
this.InvokeAsyncSafe(() => PauseNotification(NotificationPauseReason.WindowsSessionLocked));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ResumeNotification(NotificationPauseReason.WindowsSessionLocked);
|
this.InvokeAsyncSafe(() => ResumeNotification(NotificationPauseReason.WindowsSessionLocked));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
namespace TweetDuck.Management {
|
namespace TweetDuck.Management {
|
||||||
static class WindowsSessionManager {
|
static class WindowsSessionManager {
|
||||||
public static bool IsLocked { get; private set; } = false;
|
public static event EventHandler<bool>? LockStateChanged;
|
||||||
public static event EventHandler? LockStateChanged;
|
|
||||||
|
|
||||||
public static void Register() {
|
public static void Register() {
|
||||||
Win.Application.ApplicationExit += OnApplicationExit;
|
Win.Application.ApplicationExit += OnApplicationExit;
|
||||||
@ -27,8 +26,7 @@ private static void OnSessionSwitch(object? sender, SessionSwitchEventArgs e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void SetLocked(bool newState) {
|
private static void SetLocked(bool newState) {
|
||||||
IsLocked = newState;
|
LockStateChanged?.Invoke(null, newState);
|
||||||
LockStateChanged?.Invoke(null, EventArgs.Empty);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user