/// <summary> /// Makes a link between two sensors /// </summary> /// <param name="existing">The existing sensor</param> /// <param name="matching">The matching new sensor</param> private void MakeLink(Sensor existing, Sensor matching) { Debug.Print("Existing {0} Matching {1} Existing in list {2} Matching in list {3}", existing, matching, ExistingSensors.Contains(existing), NewSensors.Contains(matching)); if (existing == null || matching == null || !ExistingSensors.Contains(existing) || !NewSensors.Contains(matching)) { return; } SensorLinks.Add(new SensorMatch(existing, matching)); SensorLinks = new List <SensorMatch>(SensorLinks); ExistingSensors.Remove(existing); ExistingSensors = new List <Sensor>(ExistingSensors); NewSensors.Remove(matching); NewSensors = new List <Sensor>(NewSensors); }
/// <summary> /// Removes the currently selected sensor link /// </summary> public void RemoveLink() { if (SelectedSensorMatch == null || !SensorLinks.Contains(SelectedSensorMatch)) { return; } ExistingSensors.Add(SelectedSensorMatch.ExistingSensor); ExistingSensors = new List <Sensor>(ExistingSensors); NewSensors.Add(SelectedSensorMatch.MatchingSensor); NewSensors = new List <Sensor>(NewSensors); SensorLinks.Remove(SelectedSensorMatch); SensorLinks = new List <SensorMatch>(SensorLinks); }