public DeviceLink(DeviceBase fromDevice, FeatureType fromFeatureType, uint fromFeatureId, 
     ConsolidationDevice toDevice, FeatureType toFeatureType, uint toFeatureId,
     ConsolidateDeviceSettings.OperationType operation, EnergyEventStatus fromEventStatus, bool useTemperature)
 {
     FromDevice = fromDevice;
     FromFeatureType = fromFeatureType;
     FromFeatureId = fromFeatureId;
     ToDevice = toDevice;
     ToFeatureType = toFeatureType;
     ToFeatureId = toFeatureId;
     Operation = operation;
     UseTemperature = useTemperature;
     FromEventStatus = fromEventStatus;
     FromEventStatus.ToDeviceLinks.Add(this);
 }
        public void DeleteDevice(ConsolidateDeviceSettings consol)
        {
            ConsolidateDeviceSettings forDeletion = null;

            foreach (ConsolidateDeviceSettings consolSettings in ConsolidateToDevices)
            {
                if (consolSettings == consol)
                {
                    forDeletion = consol;
                    break;
                }
            }

            if (forDeletion != null)
            {
                consolidateToDevices.Remove(forDeletion);
                if (forDeletion.ConsolidateToDevice != null)
                    forDeletion.ConsolidateToDevice.ConsolidateFromDevices.Remove(forDeletion);
            }

            XmlElement devices = GetElement("consolidatetodevices");
            if (devices == null || consol == null)
                return;

            devices.RemoveChild(consol.settings);
            SettingChangedEventHandler("");

            DoPropertyChanged("ConsolidateDevices");
            DoPropertyChanged("ConsolidateFromDevices");
        }
 public void RegisterConsolidations()
 {
     XmlElement consolSettings = GetElement("consolidatetodevices");
     foreach (XmlElement e in consolSettings.ChildNodes)
     {
         if (e.Name == "device")
         {
             ConsolidateDeviceSettings consolidation = new ConsolidateDeviceSettings(ApplicationSettings, e, this);
             consolidateToDevices.Add(consolidation);
             if (consolidation.ConsolidateToDevice != null)
                 consolidation.ConsolidateToDevice.ConsolidateFromDevices.Add(consolidation);
         }
     }
 }
        public void AddDevice(ConsolidateDeviceSettings.OperationType operation)
        {
            XmlElement devices = GetElement("consolidatetodevices");
            XmlElement e = AddElement(devices, "device");

            ConsolidateDeviceSettings newConsol = new ConsolidateDeviceSettings(ApplicationSettings, e, this);
            newConsol.ConsolidateToDevice = null;
            newConsol.Operation = operation;
            consolidateToDevices.Add(newConsol);

            DoPropertyChanged("ConsolidateDevices");
            DoPropertyChanged("ConsolidateFromDevices");
        }