/// <summary> /// Adds a new channel setting to the collection /// of channel settings in this monitor settings record. /// </summary> public ChannelSetting AddNewChannelSetting(ChannelDefinition channelDefinition) { CollectionElement channelSettingElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; ChannelSetting channelSetting = new ChannelSetting(channelSettingElement, this); channelSetting.ChannelDefinitionIndex = (uint)channelDefinition.DataSource.ChannelDefinitions.IndexOf(channelDefinition); CollectionElement channelSettingsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag); if ((object)channelSettingsElement == null) { channelSettingsElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; m_physicalRecord.Body.Collection.AddElement(channelSettingsElement); } channelSettingsElement.AddElement(channelSettingElement); return(channelSetting); }
/// <summary> /// Removes the given channel setting from the collection of channel settings. /// </summary> /// <param name="channelSetting">The channel setting to be removed.</param> public void Remove(ChannelSetting channelSetting) { CollectionElement channelSettingsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag); List <CollectionElement> channelSettingElements; ChannelSetting setting; if ((object)channelSettingsElement == null) { return; } channelSettingElements = channelSettingsElement.GetElementsByTag(OneChannelSettingTag).Cast <CollectionElement>().ToList(); foreach (CollectionElement channelSettingElement in channelSettingElements) { setting = new ChannelSetting(channelSettingElement, this); if (Equals(channelSetting, setting)) { channelSettingsElement.RemoveElement(channelSettingElement); } } }
/// <summary> /// Adds a new channel setting to the collection /// of channel settings in this monitor settings record. /// </summary> public ChannelSetting AddNewChannelSetting() { CollectionElement channelSettingsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag); CollectionElement channelSettingElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; ChannelSetting channelSetting = new ChannelSetting(channelSettingElement, this); if ((object)channelSettingsElement == null) { channelSettingsElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; m_physicalRecord.Body.Collection.AddElement(channelSettingsElement); } channelSettingsElement.AddElement(channelSettingElement); return(channelSetting); }
/// <summary> /// Removes the given channel setting from the collection of channel settings. /// </summary> /// <param name="channelSetting">The channel setting to be removed.</param> public void Remove(ChannelSetting channelSetting) { CollectionElement channelSettingsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag); List<CollectionElement> channelSettingElements; ChannelSetting setting; if ((object)channelSettingsElement == null) return; channelSettingElements = channelSettingsElement.GetElementsByTag(OneChannelSettingTag).Cast<CollectionElement>().ToList(); foreach (CollectionElement channelSettingElement in channelSettingElements) { setting = new ChannelSetting(channelSettingElement, this); if (Equals(channelSetting, setting)) channelSettingsElement.RemoveElement(channelSettingElement); } }
/// <summary> /// Adds a new channel setting to the collection /// of channel settings in this monitor settings record. /// </summary> public ChannelSetting AddNewChannelSetting() { CollectionElement channelSettingsElement = m_physicalRecord.Body.Collection.GetCollectionByTag(ChannelSettingsArrayTag); CollectionElement channelSettingElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; ChannelSetting channelSetting = new ChannelSetting(channelSettingElement, this); if ((object)channelSettingsElement == null) { channelSettingsElement = new CollectionElement() { TagOfElement = OneChannelSettingTag }; m_physicalRecord.Body.Collection.AddElement(channelSettingsElement); } channelSettingsElement.AddElement(channelSettingElement); return channelSetting; }