Untitled
unknown
plain_text
a year ago
5.6 kB
1
Indexable
Never
public override object PushOneDestination { set { base.PushOneDestination = value; string temp = value as string; if (PushOneService != null && PushOneDestMain != null && PushOneMessage != null) return; if (temp != null) { string[] tempArr = temp.Split(' '); PushOneService = tempArr[0]; PushOneDestMain = tempArr[1]; PushOneMessage = tempArr[2]; } } } public override object PushOneCommunicationWindow { get => base.PushOneCommunicationWindow; set { base.PushOneCommunicationWindow = value; List<KeyValuePair<GXDateTime, GXDateTime>> gXDateTimes = value as List<KeyValuePair<GXDateTime, GXDateTime>>; if (gXDateTimes != null) { PushOneStart = gXDateTimes[0].Key; PushEnd = gXDateTimes[0].Value; } } } public object PushOneDestMain { get => _PushOneDestMain; set { var _value = value; var destArr = (base.PushOneDestination as string).Split(' '); if (destArr.Length != 3) return; if (string.Equals((string)value, "*") || string.Equals((string)value, "")) { _PushOneDestMain = ""; destArr[1] = "*"; } else { string[] parts = value.ToString().Split(':'); string ipAddress = parts[0].TrimStart('0').Replace(".0", "."); string port = parts[1]; string result = $"{ipAddress}:{port}"; _PushOneDestMain = destArr[1] = result; } base.PushOneDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushOneDestMain)); } } public object PushOneService { get => _PushOneService; set { var a = value; var destArr = (base.PushOneDestination as string).Split(' '); if (value is not ServiceType) { var service = Data.ComboBoxServices.FirstOrDefault(k => k.Value.Equals(value)).Key; _PushOneService = service; destArr[0] = service.ToString(); } else { _PushOneService = value; destArr[0] = value.ToString(); } this.PushOneDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushOneService)); } } public object PushOneMessage { get => _PushOneMessage; set { var destArr = (base.PushOneDestination as string).Split(' '); if (value is not MessageType) { MessageType message = Data.ComboBoxMessages.FirstOrDefault(k => k.Value.Equals(value)).Key; _PushOneMessage = message; destArr[2] = message.ToString(); } else { _PushOneMessage = value; destArr[2] = value.ToString(); } this.PushOneDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushOneMessage)); } } public DateTime PushOneStart { get => _PushOneStart; set { _PushOneStart = value; GXDateTime gxDateStart = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushOneStart.Hour), Convert.ToInt32(_PushOneStart.Minute), 0, 0); GXDateTime gxDateEnd = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushOneEnd.Hour), Convert.ToInt32(_PushOneEnd.Minute), 0, 0); KeyValuePair<GXDateTime, GXDateTime> kPair = new KeyValuePair<GXDateTime, GXDateTime>(gxDateStart, gxDateEnd); List<KeyValuePair<GXDateTime, GXDateTime>> keyValuePairs = new(); keyValuePairs.Add(kPair); base.PushOneCommunicationWindow = keyValuePairs; OnPropertyChanged(nameof(PushOneStart)); } } public DateTime PushEnd { get => _PushOneEnd; set { _PushOneEnd = value; GXDateTime gxDateStart = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushOneStart.Hour), Convert.ToInt32(_PushOneStart.Minute), 0, 0); GXDateTime gxDateEnd = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushOneEnd.Hour), Convert.ToInt32(_PushOneEnd.Minute), 0, 0); KeyValuePair<GXDateTime, GXDateTime> kPair = new KeyValuePair<GXDateTime, GXDateTime>(gxDateStart, gxDateEnd); List<KeyValuePair<GXDateTime, GXDateTime>> keyValuePairs = new(); keyValuePairs.Add(kPair); base.PushOneCommunicationWindow = keyValuePairs; OnPropertyChanged(nameof(PushEnd)); } }