Widow
/trunk/Widow/WindowManipulation.cs |
@@ -1,4 +1,5 @@ |
using System; |
using System.Collections.Generic; |
using System.Linq; |
using System.Threading; |
using System.Threading.Tasks; |
@@ -68,7 +69,8 @@ |
WindowsToManipulate = windowsToManipulate; |
} |
|
public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate, Settings settings) : this(mainForm, |
public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate, Settings settings) : this( |
mainForm, |
windowsToManipulate) |
{ |
OnWindowCreate = settings.OnWindowCreate; |
@@ -102,7 +104,7 @@ |
return; |
} |
|
if (!WindowsToManipulate.Contains(e.Title)) |
if (!WindowsToManipulate.TryGetWindow(e.Title, out _)) |
{ |
return; |
} |
@@ -116,7 +118,25 @@ |
|
public async Task Apply() |
{ |
await Task.WhenAll(WindowsToManipulate.Window.Select(window => WindowsBufferBlock.SendAsync(window))); |
var windows = new List<Window>(); |
foreach (var hWnd in Helpers.EnumerateWindows()) |
{ |
var title = Helpers.GetWindowTitle(hWnd); |
|
if (string.IsNullOrEmpty(title)) |
{ |
continue; |
} |
|
if (!WindowsToManipulate.TryGetWindow(title, out var window)) |
{ |
continue; |
} |
|
windows.Add(window); |
} |
|
await Task.WhenAll(windows.Select(window => WindowsBufferBlock.SendAsync(window))); |
} |
|
#endregion |