Dreamine.PLC.Wpf 1.0.1
Dreamine.PLC.Wpf 산업 자동화 및 I/O 기능을 제공합니다.
로딩중...
검색중...
일치하는것 없음
PlcChannelViewItem.cs
이 파일의 문서화 페이지로 가기
1using System.ComponentModel;
2using System.Runtime.CompilerServices;
3using Dreamine.PLC.Abstractions.Connections;
4
6
15public sealed class PlcChannelViewItem : INotifyPropertyChanged
16{
25 private string _name = string.Empty;
34 private PlcConnectionState _state = PlcConnectionState.Disconnected;
43 private string _description = string.Empty;
44
53 public event PropertyChangedEventHandler? PropertyChanged;
54
63 public string Name
64 {
65 get => _name;
66 set => SetField(ref _name, value);
67 }
68
77 public PlcConnectionState State
78 {
79 get => _state;
80 set => SetField(ref _state, value);
81 }
82
91 public string Description
92 {
93 get => _description;
94 set => SetField(ref _description, value);
95 }
96
145 private bool SetField<T>(ref T field, T value, [CallerMemberName] string? propertyName = null)
146 {
147 if (EqualityComparer<T>.Default.Equals(field, value))
148 {
149 return false;
150 }
151
152 field = value;
153 PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
154 return true;
155 }
156}
PropertyChangedEventHandler? PropertyChanged
bool SetField< T >(ref T field, T value, [CallerMemberName] string? propertyName=null)