SampleSmart 1.0.0.0
SampleSmart 사용 방법을 보여 주는 예제 프로젝트입니다.
로딩중...
검색중...
일치하는것 없음
SerialPortTestView.xaml.ViewModel.cs
이 파일의 문서화 페이지로 가기
1using Dreamine.MVVM.Attributes;
2using Dreamine.MVVM.ViewModels;
3
5
14public partial class SerialPortTestViewModel : ViewModelBase
15{
24 [DreamineEvent]
26
35 public IReadOnlyList<string> SerialPortNames => Event.SerialPortNames;
36
45 public IReadOnlyList<int> BaudRates => Event.BaudRates;
46
55 public IReadOnlyList<string> SerialProtocols => Event.SerialProtocols;
56
65 public IReadOnlyList<string> SerialEncodings => Event.SerialEncodings;
66
76 {
77 get => Event.SelectedSerialPortName;
78 set
79 {
80 if (Event.SelectedSerialPortName == value)
81 {
82 return;
83 }
84
85 Event.SelectedSerialPortName = value;
86 OnPropertyChanged(nameof(SelectedSerialPortName));
87 OnPropertyChanged(nameof(SerialSelectionSummary));
88 }
89 }
90
100 {
101 get => Event.SelectedBaudRate;
102 set
103 {
104 if (Event.SelectedBaudRate == value)
105 {
106 return;
107 }
108
109 Event.SelectedBaudRate = value;
110 OnPropertyChanged(nameof(SelectedBaudRate));
111 OnPropertyChanged(nameof(SerialSelectionSummary));
112 }
113 }
114
124 {
125 get => Event.SelectedSerialProtocol;
126 set
127 {
128 if (Event.SelectedSerialProtocol == value)
129 {
130 return;
131 }
132
133 Event.SelectedSerialProtocol = value;
134 OnPropertyChanged(nameof(SelectedSerialProtocol));
135 OnPropertyChanged(nameof(SerialSelectionSummary));
136 }
137 }
138
148 {
149 get => Event.SelectedSerialEncoding;
150 set
151 {
152 if (Event.SelectedSerialEncoding == value)
153 {
154 return;
155 }
156
157 Event.SelectedSerialEncoding = value;
158 OnPropertyChanged(nameof(SelectedSerialEncoding));
159 OnPropertyChanged(nameof(SerialSelectionSummary));
160 }
161 }
162
171 public string SerialSendText
172 {
173 get => Event.SerialSendText;
174 set
175 {
176 if (Event.SerialSendText == value)
177 {
178 return;
179 }
180
181 Event.SerialSendText = value;
182 OnPropertyChanged(nameof(SerialSendText));
183 }
184 }
185
194 public string SerialSelectionSummary => Event.SerialSelectionSummary;
195
204 [DreamineCommand("Event.RefreshPorts")]
205 private partial void RefreshPorts();
206
215 [DreamineCommand("Event.ConnectSerial")]
216 private partial void ConnectSerial();
217
226 [DreamineCommand("Event.DisconnectSerial")]
227 private partial void DisconnectSerial();
228
237 [DreamineCommand("Event.SendSerial")]
238 private partial void SendSerial();
239
257 {
258 ArgumentNullException.ThrowIfNull(@event);
259
260 _event = @event;
261 }
262}