Widow – Diff between revs 6 and 7

Subversion Repositories:
Rev:
Only display areas with differencesIgnore whitespace
Rev 6 Rev 7
1 using System; 1 using System;
2   2  
3 namespace Widow 3 namespace Widow
4 { 4 {
5 public class Apply : IDisposable 5 public class WindowRescale : IDisposable
6 { 6 {
7 #region Public Enums, Properties and Fields 7 #region Public Enums, Properties and Fields
8   8  
9 public bool OnWindowCreate { get; set; } 9 public bool OnWindowCreate { get; set; }
10   10  
11 public MainForm Form { get; set; } 11 public MainForm Form { get; set; }
12   12  
13 #endregion 13 #endregion
14   14  
15 #region Private Delegates, Events, Enums, Properties, Indexers and Fields 15 #region Private Delegates, Events, Enums, Properties, Indexers and Fields
16   16  
17 private Windows.Windows Windows { get; } 17 private Windows.Windows Windows { get; }
18   18  
19 #endregion 19 #endregion
20   20  
21 #region Constructors, Destructors and Finalizers 21 #region Constructors, Destructors and Finalizers
22   22  
23 public Apply() 23 public WindowRescale()
24 { 24 {
25 } 25 }
26   26  
27 public Apply(MainForm mainForm) : this() 27 public WindowRescale(MainForm mainForm) : this()
28 { 28 {
29 Form = mainForm; 29 Form = mainForm;
30   30  
31 Form.WindowCreated += Form_WindowCreated; 31 Form.WindowCreated += Form_WindowCreated;
32 } 32 }
33   33  
34 public Apply(MainForm mainForm, Windows.Windows windows) : this(mainForm) 34 public WindowRescale(MainForm mainForm, Windows.Windows windows) : this(mainForm)
35 { 35 {
36 Windows = windows; 36 Windows = windows;
37 } 37 }
38   38  
39 public void Dispose() 39 public void Dispose()
40 { 40 {
41 Form.WindowCreated -= Form_WindowCreated; 41 Form.WindowCreated -= Form_WindowCreated;
42 } 42 }
43   43  
44 #endregion 44 #endregion
45   45  
46 #region Event Handlers 46 #region Event Handlers
47   47  
48 private void Form_WindowCreated(object sender, WindowCreatedEventArgs e) 48 private void Form_WindowCreated(object sender, WindowCreatedEventArgs e)
49 { 49 {
50 if (!OnWindowCreate) 50 if (!OnWindowCreate)
51 { 51 {
52 return; 52 return;
53 } 53 }
54   54  
55 foreach (var window in Windows.Window) 55 foreach (var window in Windows.Window)
56 { 56 {
57 if (window.Name != e.Name) 57 if (window.Name != e.Name)
58 { 58 {
59 continue; 59 continue;
60 } 60 }
61   61  
62 var hWnd = Helpers.FindWindowByTitle(window.Name); 62 var hWnd = Helpers.FindWindowByTitle(window.Name);
-   63 if (hWnd == IntPtr.Zero)
-   64 {
-   65 continue;
-   66 }
-   67  
-   68 Natives.MoveWindow(hWnd, window.Left, window.Top, window.Width, window.Height, true);
-   69 }
-   70 }
-   71  
-   72 #endregion
-   73  
-   74 #region Public Methods
-   75  
-   76 public void Apply()
-   77 {
-   78 foreach (var window in Windows.Window)
-   79 {
-   80 var hWnd = Helpers.FindWindowByTitle(window.Name);
63 if (hWnd == IntPtr.Zero) 81 if (hWnd == IntPtr.Zero)
64 { 82 {
65 continue; 83 continue;
66 } 84 }
67   85  
68 Natives.MoveWindow(hWnd, window.Left, window.Top, window.Width, window.Height, true); 86 Natives.MoveWindow(hWnd, window.Left, window.Top, window.Width, window.Height, true);
69 } 87 }
70 } 88 }
71   89  
72 #endregion 90 #endregion
73 } 91 }
74 } 92 }
75   93  
76
Generated by GNU Enscript 1.6.5.90.
94
Generated by GNU Enscript 1.6.5.90.
77   95  
78   96  
79   97