Widow – Diff between revs 1 and 5
?pathlinks?
Rev 1 | Rev 5 | |||
---|---|---|---|---|
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 = "Name")] |
13 | [XmlElement(ElementName = "Name")] |
|
14 | public string Name |
14 | public string Name |
|
15 | { |
15 | { |
|
16 | get => _name; |
16 | get => _name; |
|
17 | set |
17 | set |
|
18 | { |
18 | { |
|
19 | if (value == _name) |
19 | if (value == _name) |
|
20 | { |
20 | { |
|
21 | return; |
21 | return; |
|
22 | } |
22 | } |
|
23 | |
23 | |
|
24 | _name = value; |
24 | _name = value; |
|
25 | OnPropertyChanged(); |
25 | OnPropertyChanged(); |
|
26 | } |
26 | } |
|
27 | } |
27 | } |
|
28 | |
28 | |
|
29 | [XmlElement(ElementName = "Width")] |
29 | [XmlElement(ElementName = "Width")] |
|
30 | public int Width |
30 | public int Width |
|
31 | { |
31 | { |
|
32 | get => _width; |
32 | get => _width; |
|
33 | set |
33 | set |
|
34 | { |
34 | { |
|
35 | if (value == _width) |
35 | if (value == _width) |
|
36 | { |
36 | { |
|
37 | return; |
37 | return; |
|
38 | } |
38 | } |
|
39 | |
39 | |
|
40 | _width = value; |
40 | _width = value; |
|
41 | OnPropertyChanged(); |
41 | OnPropertyChanged(); |
|
42 | } |
42 | } |
|
43 | } |
43 | } |
|
44 | |
44 | |
|
45 | [XmlElement(ElementName = "Height")] |
45 | [XmlElement(ElementName = "Height")] |
|
46 | public int Height |
46 | public int Height |
|
47 | { |
47 | { |
|
48 | get => _height; |
48 | get => _height; |
|
49 | set |
49 | set |
|
50 | { |
50 | { |
|
51 | if (value == _height) |
51 | if (value == _height) |
|
52 | { |
52 | { |
|
53 | return; |
53 | return; |
|
54 | } |
54 | } |
|
55 | |
55 | |
|
56 | _height = value; |
56 | _height = value; |
|
57 | OnPropertyChanged(); |
57 | OnPropertyChanged(); |
|
58 | } |
58 | } |
|
59 | } |
59 | } |
|
60 | |
60 | |
|
61 | [XmlElement(ElementName = "Left")] |
61 | [XmlElement(ElementName = "Left")] |
|
62 | public int Left |
62 | public int Left |
|
63 | { |
63 | { |
|
64 | get => _left; |
64 | get => _left; |
|
65 | set |
65 | set |
|
66 | { |
66 | { |
|
67 | if (value == _left) |
67 | if (value == _left) |
|
68 | { |
68 | { |
|
69 | return; |
69 | return; |
|
70 | } |
70 | } |
|
71 | |
71 | |
|
72 | _left = value; |
72 | _left = value; |
|
73 | OnPropertyChanged(); |
73 | OnPropertyChanged(); |
|
74 | } |
74 | } |
|
75 | } |
75 | } |
|
76 | |
76 | |
|
77 | [XmlElement(ElementName = "Top")] |
77 | [XmlElement(ElementName = "Top")] |
|
78 | public int Top |
78 | public int Top |
|
79 | { |
79 | { |
|
80 | get => _top; |
80 | get => _top; |
|
81 | set |
81 | set |
|
82 | { |
82 | { |
|
83 | if (value == _top) |
83 | if (value == _top) |
|
84 | { |
84 | { |
|
85 | return; |
85 | return; |
|
86 | } |
86 | } |
|
87 | |
87 | |
|
88 | _top = value; |
88 | _top = value; |
|
89 | OnPropertyChanged(); |
89 | OnPropertyChanged(); |
|
90 | } |
90 | } |
|
91 | } |
91 | } |
|
92 | |
92 | |
|
93 | #endregion |
93 | #endregion |
|
94 | |
94 | |
|
95 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
95 | #region Private Delegates, Events, Enums, Properties, Indexers and Fields |
|
96 | |
96 | |
|
97 | private int _height; |
97 | private int _height; |
|
98 | |
98 | |
|
99 | private int _left; |
99 | private int _left; |
|
100 | |
100 | |
|
101 | private string _name; |
101 | private string _name; |
|
102 | |
102 | |
|
103 | private int _top; |
103 | private int _top; |
|
104 | |
104 | |
|
105 | private int _width; |
105 | private int _width; |
|
106 | |
106 | |
|
107 | #endregion |
107 | #endregion |
|
108 | |
108 | |
|
109 | #region Constructors, Destructors and Finalizers |
109 | #region Constructors, Destructors and Finalizers |
|
110 | |
110 | |
|
111 | [UsedImplicitly] |
111 | [UsedImplicitly] |
|
112 | public Window() |
112 | public Window() |
|
113 | { |
113 | { |
|
114 | } |
114 | } |
|
- | 115 | |
||
115 | public Window(string name, int top, int left, int width, int height) : this() |
116 | public Window(string name, int top, int left, int width, int height) : this() |
|
116 | { |
117 | { |
|
117 | Name = name; |
118 | Name = name; |
|
118 | Top = top; |
119 | Top = top; |
|
119 | Left = left; |
120 | Left = left; |
|
120 | Width = width; |
121 | Width = width; |
|
121 | Height = height; |
122 | Height = height; |
|
122 | } |
123 | } |
|
123 | |
124 | |
|
124 | #endregion |
125 | #endregion |
|
125 | |
126 | |
|
126 | #region Interface |
127 | #region Interface |
|
127 | |
128 | |
|
128 | public event PropertyChangedEventHandler PropertyChanged; |
129 | public event PropertyChangedEventHandler PropertyChanged; |
|
129 | |
130 | |
|
130 | #endregion |
131 | #endregion |
|
131 | |
132 | |
|
132 | #region Private Methods |
133 | #region Private Methods |
|
133 | |
134 | |
|
134 | [NotifyPropertyChangedInvocator] |
135 | [NotifyPropertyChangedInvocator] |
|
135 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
136 | protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null) |
|
136 | { |
137 | { |
|
137 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
138 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
138 | } |
139 | } |
|
139 | |
140 | |
|
140 | #endregion |
141 | #endregion |
|
141 | } |
142 | } |
|
142 | } |
143 | } |
|
143 | |
144 | |
|
144 |
|
145 |
|
|
145 | |
146 | |
|
146 | |
147 | |
|
147 | |
148 | |