Widow – Diff between revs 11 and 12

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 11 Rev 12
Line 1... Line 1...
1 using System; 1 using System;
-   2 using System.Collections.Generic;
2 using System.Linq; 3 using System.Linq;
3 using System.Threading; 4 using System.Threading;
4 using System.Threading.Tasks; 5 using System.Threading.Tasks;
5 using System.Threading.Tasks.Dataflow; 6 using System.Threading.Tasks.Dataflow;
6 using Windows; 7 using Windows;
Line 66... Line 67...
66 public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate) : this(mainForm) 67 public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate) : this(mainForm)
67 { 68 {
68 WindowsToManipulate = windowsToManipulate; 69 WindowsToManipulate = windowsToManipulate;
69 } 70 }
Line 70... Line 71...
70   71  
-   72 public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate, Settings settings) : this(
71 public WindowManipulation(MainForm mainForm, Windows.Windows windowsToManipulate, Settings settings) : this(mainForm, 73 mainForm,
72 windowsToManipulate) 74 windowsToManipulate)
73 { 75 {
74 OnWindowCreate = settings.OnWindowCreate; 76 OnWindowCreate = settings.OnWindowCreate;
75 ApplyEveryTimeEnabled = settings.ApplyEveryTimeEnabled; 77 ApplyEveryTimeEnabled = settings.ApplyEveryTimeEnabled;
Line 100... Line 102...
100 if (!OnWindowCreate) 102 if (!OnWindowCreate)
101 { 103 {
102 return; 104 return;
103 } 105 }
Line 104... Line 106...
104   106  
105 if (!WindowsToManipulate.Contains(e.Title)) 107 if (!WindowsToManipulate.TryGetWindow(e.Title, out _))
106 { 108 {
107 return; 109 return;
Line 108... Line 110...
108 } 110 }
Line 114... Line 116...
114   116  
Line 115... Line 117...
115 #region Public Methods 117 #region Public Methods
116   118  
-   119 public async Task Apply()
-   120 {
-   121 var windows = new List<Window>();
-   122 foreach (var hWnd in Helpers.EnumerateWindows())
-   123 {
-   124 var title = Helpers.GetWindowTitle(hWnd);
-   125  
-   126 if (string.IsNullOrEmpty(title))
-   127 {
-   128 continue;
-   129 }
-   130  
-   131 if (!WindowsToManipulate.TryGetWindow(title, out var window))
-   132 {
-   133 continue;
-   134 }
-   135  
-   136 windows.Add(window);
117 public async Task Apply() 137 }
118 { 138  
Line 119... Line 139...
119 await Task.WhenAll(WindowsToManipulate.Window.Select(window => WindowsBufferBlock.SendAsync(window))); 139 await Task.WhenAll(windows.Select(window => WindowsBufferBlock.SendAsync(window)));
Line 120... Line 140...
120 } 140 }