Widow – Diff between revs 11 and 14
?pathlinks?
Rev 11 | Rev 14 | |||
---|---|---|---|---|
1 | using System.ComponentModel; |
1 | using System.ComponentModel; |
|
2 | using System.Runtime.CompilerServices; |
2 | using System.Runtime.CompilerServices; |
|
3 | using System.Xml.Serialization; |
3 | using System.Xml.Serialization; |
|
4 | using Windows.Annotations; |
4 | using Windows.Annotations; |
|
5 | |
5 | |
|
6 | namespace Windows |
6 | namespace Windows |
|
7 | { |
7 | { |
|
8 | [XmlRoot(ElementName = "Window")] |
8 | [XmlRoot(ElementName = "Window")] |
|
9 | public class Window : INotifyPropertyChanged |
9 | public class Window : INotifyPropertyChanged |
|
10 | { |
10 | { |
|
11 | #region Public Enums, Properties and Fields |
11 | #region Public Enums, Properties and Fields |
|
12 | |
12 | |
|
13 | [XmlElement(ElementName = "Process")] |
13 | [XmlElement(ElementName = "Process")] |
|
14 | public string Process |
14 | public string Class |
|
15 | { |
15 | { |
|
16 | get => _process; |
16 | get => _class; |
|
17 | set |
17 | set |
|
18 | { |
18 | { |
|
19 | if (value == _process) |
19 | if (value == _class) |
|
20 | { |
20 | { |
|
21 | return; |
21 | return; |
|
22 | } |
22 | } |
|
23 | |
23 | |
|
24 | _process = value; |
24 | _class = value; |
|
25 | OnPropertyChanged(); |
25 | OnPropertyChanged(); |
|
26 | } |
26 | } |
|
27 | } |
27 | } |
|
28 | |
28 | |
|
29 | [XmlElement(ElementName = "Name")] |
29 | [XmlElement(ElementName = "Name")] |
|
30 | public string Title |
30 | public string Title |
|
31 | { |
31 | { |
|
32 | get => _title; |
32 | get => _title; |
|
33 | set |
33 | set |
|
34 | { |
34 | { |
|
35 | if (value == _title) |
35 | if (value == _title) |
|
36 | { |
36 | { |
|
37 | return; |
37 | return; |
|
38 | } |
38 | } |
|
39 | |
39 | |
|
40 | _title = value; |
40 | _title = value; |
|
41 | OnPropertyChanged(); |
41 | OnPropertyChanged(); |
|
42 | } |
42 | } |
|
43 | } |
43 | } |
|
44 | |
44 | |
|
45 | [XmlElement(ElementName = "IgnoreWidth")] |
45 | [XmlElement(ElementName = "IgnoreWidth")] |
|
46 | public bool IgnoreWidth |
46 | public bool IgnoreWidth |
|
47 | { |
47 | { |
|
48 | get => _ignoreWidth; |
48 | get => _ignoreWidth; |
|
49 | set |
49 | set |
|
50 | { |
50 | { |
|
51 | if (value == _ignoreWidth) |
51 | if (value == _ignoreWidth) |
|
52 | { |
52 | { |
|
53 | return; |
53 | return; |
|
54 | } |
54 | } |
|
55 | |
55 | |
|
56 | _ignoreWidth = value; |
56 | _ignoreWidth = value; |
|
57 | OnPropertyChanged(); |
57 | OnPropertyChanged(); |
|
58 | } |
58 | } |
|
59 | } |
59 | } |
|
60 | |
60 | |
|
61 | [XmlElement(ElementName = "Width")] |
61 | [XmlElement(ElementName = "Width")] |
|
62 | public int Width |
62 | public int Width |
|
63 | { |
63 | { |
|
64 | get => _width; |
64 | get => _width; |
|
65 | set |
65 | set |
|
66 | { |
66 | { |
|
67 | if (value == _width) |
67 | if (value == _width) |
|
68 | { |
68 | { |
|
69 | return; |
69 | return; |
|
70 | } |
70 | } |
|
71 | |
71 | |
|
72 | _width = value; |
72 | _width = value; |
|
73 | OnPropertyChanged(); |
73 | OnPropertyChanged(); |
|
74 | } |
74 | } |
|
75 | } |
75 | } |
|
76 | |
76 | |
|
77 | [XmlElement(ElementName = "IgnoreHeight")] |
77 | [XmlElement(ElementName = "IgnoreHeight")] |
|
78 | public bool IgnoreHeight |
78 | public bool IgnoreHeight |
|
79 | { |
79 | { |
|
80 | get => _ignoreHeight; |
80 | get => _ignoreHeight; |
|
81 | set |
81 | set |
|
82 | { |
82 | { |
|
83 | if (value == _ignoreHeight) |
83 | if (value == _ignoreHeight) |
|
84 | { |
84 | { |
|
85 | return; |
85 | return; |
|
86 | } |
86 | } |
|
87 | |
87 | |
|
88 | _ignoreHeight = value; |
88 | _ignoreHeight = value; |
|
89 | OnPropertyChanged(); |
89 | OnPropertyChanged(); |
|
90 | } |
90 | } |
|
91 | } |
91 | } |
|
92 | |
92 | |
|
93 | [XmlElement(ElementName = "Height")] |
93 | [XmlElement(ElementName = "Height")] |
|
94 | public int Height |
94 | public int Height |
|
95 | { |
95 | { |
|
96 | get => _height; |
96 | get => _height; |
|
97 | set |
97 | set |
|
98 | { |
98 | { |
|
99 | if (value == _height) |
99 | if (value == _height) |
|
100 | { |
100 | { |
|
101 | return; |
101 | return; |
|
102 | } |
102 | } |
|
103 | |
103 | |
|
104 | _height = value; |
104 | _height = value; |
|
105 | OnPropertyChanged(); |
105 | OnPropertyChanged(); |
|
106 | } |
106 | } |
|
107 | } |
107 | } |
|
108 | |
108 | |
|
109 | [XmlElement(ElementName = "IgnoreLeft")] |
109 | [XmlElement(ElementName = "IgnoreLeft")] |
|
110 | public bool IgnoreLeft |
110 | public bool IgnoreLeft |
|
111 | { |
111 | { |
|
112 | get => _ignoreLeft; |
112 | get => _ignoreLeft; |
|
113 | set |
113 | set |
|
114 | { |
114 | { |
|
115 | if (value == _ignoreLeft) |
115 | if (value == _ignoreLeft) |
|
116 | { |
116 | { |
|
117 | return; |
117 | return; |
|
118 | } |
118 | } |
|
119 | |
119 | |
|
120 | _ignoreLeft = value; |
120 | _ignoreLeft = value; |
|
121 | OnPropertyChanged(); |
121 | OnPropertyChanged(); |
|
122 | } |
122 | } |
|
123 | } |
123 | } |
|
124 | |
124 | |
|
125 | [XmlElement(ElementName = "Left")] |
125 | [XmlElement(ElementName = "Left")] |
|
126 | public int Left |
126 | public int Left |
|
127 | { |
127 | { |
|
128 | get => _left; |
128 | get => _left; |
|
129 | set |
129 | set |
|
130 | { |
130 | { |
|
131 | if (value == _left) |
131 | if (value == _left) |
|
132 | { |
132 | { |
|
133 | return; |
133 | return; |
|
134 | } |
134 | } |
|
135 | |
135 | |
|
136 | _left = value; |
136 | _left = value; |
|
137 | OnPropertyChanged(); |
137 | OnPropertyChanged(); |
|
138 | } |
138 | } |
|
139 | } |
139 | } |
|
140 | |
140 | |
|
141 | [XmlElement(ElementName = "IgnoreTop")] |
141 | [XmlElement(ElementName = "IgnoreTop")] |
|
142 | public bool IgnoreTop |
142 | public bool IgnoreTop |
|
143 | { |
143 | { |
|
144 | get => _ignoreTop; |
144 | get => _ignoreTop; |
|
145 | set |
145 | set |
|
146 | { |
146 | { |
|
147 | if (value == _ignoreTop) |
147 | if (value == _ignoreTop) |
|
148 | { |
148 | { |
|
149 | return; |
149 | return; |
|
150 | } |
150 | } |
|
151 | |
151 | |
|
152 | _ignoreTop = value; |
152 | _ignoreTop = value; |
|
153 | OnPropertyChanged(); |
153 | OnPropertyChanged(); |
|
154 | } |
154 | } |
|
155 | } |
155 | } |
|
156 | |
156 | |
|
157 | [XmlElement(ElementName = "Top")] |
157 | [XmlElement(ElementName = "Top")] |
|
158 | public int Top |
158 | public int Top |
|
159 | { |
159 | { |
|
160 | get => _top; |
160 | get => _top; |
|
161 | set |
161 | set |
|
162 | { |
162 | { |
|
163 | if (value == _top) |
163 | if (value == _top) |
|
164 | { |
164 | { |
|
165 | return; |
165 | return; |
|
166 | } |
166 | } |
|
167 | |
167 | |
|
168 | _top = value; |
168 | _top = value; |
|
169 | OnPropertyChanged(); |
169 | OnPropertyChanged(); |
|
170 | } |
170 | } |
|
171 | } |
171 | } |
|
172 | |
172 | |
|
173 | #endregion |
173 | #endregion |
|
174 | |
174 | |
|
175 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
175 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
|
- | 176 | |
||
- | 177 | private string _class; |
||
176 | |
178 | |
|
177 | private int _height; |
179 | private int _height; |
|
178 | |
180 | |
|
179 | private bool _ignoreHeight; |
181 | private bool _ignoreHeight; |
|
180 | |
182 | |
|
181 | private bool _ignoreLeft; |
183 | private bool _ignoreLeft; |
|
182 | |
184 | |
|
183 | private bool _ignoreTop; |
185 | private bool _ignoreTop; |
|
184 | |
186 | |
|
185 | private bool _ignoreWidth; |
187 | private bool _ignoreWidth; |
|
186 | |
188 | |
|
187 | private int _left; |
189 | private int _left; |
|
188 | |
- | ||
189 | private string _process; |
- | ||
190 | |
190 | |
|
191 | private string _title; |
191 | private string _title; |
|
192 | |
192 | |
|
193 | private int _top; |
193 | private int _top; |
|
194 | |
194 | |
|
195 | private int _width; |
195 | private int _width; |
|
196 | |
196 | |
|
197 | #endregion |
197 | #endregion |
|
198 | |
198 | |
|
199 | #region Constructors, Destructors and Finalizers |
199 | #region Constructors, Destructors and Finalizers |
|
200 | |
200 | |
|
201 | [UsedImplicitly] |
201 | [UsedImplicitly] |
|
202 | public Window() |
202 | public Window() |
|
203 | { |
203 | { |
|
204 | } |
204 | } |
|
205 | |
205 | |
|
206 | public Window(string process, string title, int top, int left, int width, int height) : this() |
206 | public Window(string @class, string title, int top, int left, int width, int height) : this() |
|
207 | { |
207 | { |
|
208 | Process = process; |
208 | Class = @class; |
|
209 | Title = title; |
209 | Title = title; |
|
210 | Top = top; |
210 | Top = top; |
|
211 | Left = left; |
211 | Left = left; |
|
212 | Width = width; |
212 | Width = width; |
|
213 | Height = height; |
213 | Height = height; |
|
214 | } |
214 | } |
|
215 | |
215 | |
|
216 | #endregion |
216 | #endregion |
|
217 | |
217 | |
|
218 | #region Interface |
218 | #region Interface |
|
219 | |
219 | |
|
220 | public event PropertyChangedEventHandler PropertyChanged; |
220 | public event PropertyChangedEventHandler PropertyChanged; |
|
221 | |
221 | |
|
222 | #endregion |
222 | #endregion |
|
223 | |
223 | |
|
224 | #region Private Methods |
224 | #region Private Methods |
|
225 | |
225 | |
|
226 | [NotifyPropertyChangedInvocator] |
226 | [NotifyPropertyChangedInvocator] |
|
227 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
227 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
|
228 | { |
228 | { |
|
229 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
229 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
230 | } |
230 | } |
|
231 | |
231 | |
|
232 | #endregion |
232 | #endregion |
|
233 | } |
233 | } |
|
234 | } |
234 | } |
|
235 | |
235 | |
|
236 |
|
236 |
|
|
237 | |
237 | |
|
238 | |
238 | |
|
239 | |
239 | |