Clear WindowInfo Hashset before refilling.
This commit is contained in:
parent
02314701f4
commit
2461232b5b
@ -8,13 +8,16 @@ public class WindowManager : IDisposable
|
|||||||
{
|
{
|
||||||
public readonly HashSet<WindowInfo> Windows = new();
|
public readonly HashSet<WindowInfo> Windows = new();
|
||||||
public int UpdateInterval = 10;
|
public int UpdateInterval = 10;
|
||||||
private bool KeepUpdating = true;
|
private bool _keepUpdating = true;
|
||||||
public WindowManager()
|
public WindowManager()
|
||||||
{
|
{
|
||||||
Thread t = new (() =>
|
Thread t = new (() =>
|
||||||
{
|
{
|
||||||
while(KeepUpdating)
|
while (_keepUpdating)
|
||||||
|
{
|
||||||
|
Windows.Clear();
|
||||||
EnumWindows(WindowPlacement, 0);
|
EnumWindows(WindowPlacement, 0);
|
||||||
|
}
|
||||||
Thread.Sleep(UpdateInterval);
|
Thread.Sleep(UpdateInterval);
|
||||||
});
|
});
|
||||||
t.Start();
|
t.Start();
|
||||||
@ -75,7 +78,7 @@ public class WindowManager : IDisposable
|
|||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
KeepUpdating = false;
|
_keepUpdating = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user