private void OkBtn_Click(object sender, RoutedEventArgs e) { if (!MonchaHub.CheckDeviceInHub(this.LMeter.IP)) { MonchaHub.LMeters.Add(this.LMeter); } else { } this.Close(); }
private void RefreshList() { this.iPs = MonchaSearch.FindDevicesOverBroadcast2(MonchaSearch.GetAvailabeBroadcastAddresses()); if (this.iPs.Count > 0) { this.NewDevices.Clear(); foreach (BroadcastReply2 broadcastReply in iPs) { IpSelect ipSelect = new IpSelect() { iPAddress = new IPAddress(BitConverter.GetBytes(broadcastReply.ipv4)), IsSelected = false }; //if not if (MonchaHub.CheckDeviceInHub(ipSelect.iPAddress) == false) { this.NewDevices.Add(ipSelect); } } } this.OldDevices.Clear(); foreach (MonchaDevice monchaDevice in MonchaHub.Devices) { if (monchaDevice != null) { this.OldDevices.Add(new IpSelect() { iPAddress = monchaDevice.iPAddress, IsSelected = true }); } } if (this.NewDevices.Count > 0) { FoundDeviceList.ItemsSource = this.NewDevices; MonchaDeviceList.ItemsSource = this.OldDevices; } }