/// <summary> /// Initializes the object. /// </summary> private void Initialize(AnimalSoundState variable) { lock (Lock) { m_variable = variable; variable.Value = m_value; variable.OnReadValue = OnReadValue; variable.OnSimpleWriteValue = OnWriteValue; BaseVariableState instance = null; List <BaseInstanceState> updateList = new List <BaseInstanceState>(); updateList.Add(variable); instance = m_variable.Verb; instance.OnReadValue = OnRead_Verb; instance.OnSimpleWriteValue = OnWrite_Verb; updateList.Add(instance); instance = m_variable.AudioFile; instance.OnReadValue = OnRead_AudioFile; instance.OnSimpleWriteValue = OnWrite_AudioFile; updateList.Add(instance); SetUpdateList(updateList); } }
/// <summary> /// Initializes the instance with its defalt attribute values. /// </summary> public AnimalSoundValue(AnimalSoundState variable, AnimalSound value, object dataLock) : base(dataLock) { m_value = value; if (m_value == null) { m_value = new AnimalSound(); } Initialize(variable); }
/// <summary> /// Finds the child with the specified browse name. /// </summary> protected override BaseInstanceState FindChild( ISystemContext context, QualifiedName browseName, bool createOrReplace, BaseInstanceState replacement) { if (QualifiedName.IsNull(browseName)) { return(null); } BaseInstanceState instance = null; switch (browseName.Name) { case animal.BrowseNames.LegCount: { if (createOrReplace) { if (LegCount == null) { if (replacement == null) { LegCount = new PropertyState <uint>(this); } else { LegCount = (PropertyState <uint>)replacement; } } } instance = LegCount; break; } case animal.BrowseNames.Sound: { if (createOrReplace) { if (Sound == null) { if (replacement == null) { Sound = new AnimalSoundState(this); } else { Sound = (AnimalSoundState)replacement; } } } instance = Sound; break; } } if (instance != null) { return(instance); } return(base.FindChild(context, browseName, createOrReplace, replacement)); }