Untitled
unknown
plain_text
2 months ago
5.6 kB
1
Indexable
Never
public override object PushTwoDestination { set { base.PushTwoDestination = value; string temp = value as string; if (PushTwoService != null && PushTwoDestMain != null && PushTwoMessage != null) return; if (temp != null) { string[] tempArr = temp.Split(' '); PushTwoService = tempArr[0]; PushTwoDestMain = tempArr[1]; PushTwoMessage = tempArr[2]; } } } public override object PushTwoCommunicationWindow { get => base.PushTwoCommunicationWindow; set { base.PushTwoCommunicationWindow = value; List<KeyValuePair<GXDateTime, GXDateTime>> gXDateTimes = value as List<KeyValuePair<GXDateTime, GXDateTime>>; if (gXDateTimes != null) { PushTwoStart = gXDateTimes[0].Key; PushEnd = gXDateTimes[0].Value; } } } public object PushTwoDestMain { get => _PushTwoDestMain; set { var _value = value; var destArr = (base.PushTwoDestination as string).Split(' '); if (destArr.Length != 3) return; if (string.Equals((string)value, "*") || string.Equals((string)value, "")) { _PushTwoDestMain = ""; destArr[1] = "*"; } else { string[] parts = value.ToString().Split(':'); string ipAddress = parts[0].TrimStart('0').Replace(".0", "."); string port = parts[1]; string result = $"{ipAddress}:{port}"; _PushTwoDestMain = destArr[1] = result; } base.PushTwoDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushTwoDestMain)); } } public object PushTwoService { get => _PushTwoService; set { var a = value; var destArr = (base.PushTwoDestination as string).Split(' '); if (value is not ServiceType) { var service = Data.ComboBoxServices.FirstOrDefault(k => k.Value.Equals(value)).Key; _PushTwoService = service; destArr[0] = service.ToString(); } else { _PushTwoService = value; destArr[0] = value.ToString(); } this.PushTwoDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushTwoService)); } } public object PushTwoMessage { get => _PushTwoMessage; set { var destArr = (base.PushTwoDestination as string).Split(' '); if (value is not MessageType) { MessageType message = Data.ComboBoxMessages.FirstOrDefault(k => k.Value.Equals(value)).Key; _PushTwoMessage = message; destArr[2] = message.ToString(); } else { _PushTwoMessage = value; destArr[2] = value.ToString(); } this.PushTwoDestination = string.Join(" ", destArr); OnPropertyChanged(nameof(PushTwoMessage)); } } public DateTime PushTwoStart { get => _PushTwoStart; set { _PushTwoStart = value; GXDateTime gxDateStart = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushTwoStart.Hour), Convert.ToInt32(_PushTwoStart.Minute), 0, 0); GXDateTime gxDateEnd = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushTwoEnd.Hour), Convert.ToInt32(_PushTwoEnd.Minute), 0, 0); KeyValuePair<GXDateTime, GXDateTime> kPair = new KeyValuePair<GXDateTime, GXDateTime>(gxDateStart, gxDateEnd); List<KeyValuePair<GXDateTime, GXDateTime>> keyValuePairs = new(); keyValuePairs.Add(kPair); base.PushTwoCommunicationWindow = keyValuePairs; OnPropertyChanged(nameof(PushTwoStart)); } } public DateTime PushTwoEnd { get => _PushTwoEnd; set { _PushTwoEnd = value; GXDateTime gxDateStart = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushTwoStart.Hour), Convert.ToInt32(_PushTwoStart.Minute), 0, 0); GXDateTime gxDateEnd = new GXDateTime(0xFFFF, 0xFF, 0xFF, Convert.ToInt32(_PushTwoEnd.Hour), Convert.ToInt32(_PushTwoEnd.Minute), 0, 0); KeyValuePair<GXDateTime, GXDateTime> kPair = new KeyValuePair<GXDateTime, GXDateTime>(gxDateStart, gxDateEnd); List<KeyValuePair<GXDateTime, GXDateTime>> keyValuePairs = new(); keyValuePairs.Add(kPair); base.PushTwoCommunicationWindow = keyValuePairs; OnPropertyChanged(nameof(PushTwoEnd)); } }