예제 #1
0
 public void AddOrMergeProperty(string identifier, VariableState secondState)
 {
     if (PropertyStates.ContainsKey(identifier))
     {
         PropertyStates[identifier].Replace(secondState);
         MergeTaint(secondState.Taint);
     }
     else
     {
         Properties.Add(identifier, secondState);
     }
 }
        public VariableState AddOrMergeProperty(string identifier, VariableState secondState)
        {
            if (PropertyStates.ContainsKey(identifier))
            {
                PropertyStates[identifier].Replace(secondState);
                ResolveTaint(secondState.Taint);
            }
            else
            {
                Properties.Add(identifier, secondState);
            }

            return(this);
        }
예제 #3
0
 /// <summary>
 /// NotifyPropertyChange informs software of changes in the GXProperty.
 /// </summary>
 /// <param name="status">The type of the event to be raised.</param>
 public void NotifyPropertyChange(PropertyStates status)
 {
     NotifyUpdated(new GXPropertyEventArgs(this, status));
 }
예제 #4
0
		/// <summary>
		/// Set value for the GXProperty as hex.
		/// </summary>
        public void SetValueAsHex(string value, bool useUIValue, PropertyStates status)
        {
            //TODO:
            NotifyPropertyChange(status);
        }               		
예제 #5
0
		/// <summary>
		/// SetValue sets the value of a GXProperty. If ValueItems are used, the value must be in the ValueItems collection
		/// and the Type must be String.
		/// </summary>
		/// <example>
		/// <code>
		/// Dim value = "SomeValue"
		/// GXProperty1.SetValue value, False
		/// </code>
		/// </example>
		/// <param name="value">Property value</param>
		/// <param name="uiValue">Is given vaue UI value or device value.</param>
		/// <param name="status">A status to be set for the GXProperty after the value has been set.</param>
		/// <seealso cref="T_Gurux_Device_GXValue">GXValue</seealso>
        public void SetValue(object value, bool uiValue, PropertyStates status)
        {
            bool change = false;
            if (!uiValue)
            {
                bool bFound = false;
                foreach (GXValueItem it in this.Values)
                {
                    if (string.Compare(Convert.ToString(it.DeviceValue), Convert.ToString(value), true) == 0)
                    {
                        bFound = true;
                        value = it.UIValue;
                        break;
                    }
                }
                if (!bFound)
                {
                    value = this.Device.DeviceValueToUIValue(this, value);
                }
            }
            //If value collection is used.
            else if (this.Values.Count != 0)
            {
                if (ForcePresetValues)
                {
                    bool bFound = false;
                    foreach (GXValueItem it in this.Values)
                    {
                        if (string.Compare(Convert.ToString(it.UIValue), Convert.ToString(value), true) == 0)
                        {
                            bFound = true;
                            break;
                        }
                    }
                    if (!bFound)
                    {
                        throw new Exception(Resources.InvalidValueForceedPresetValueNotFound);
                    }
                }
                
            }
            else if (ValueType != null)
            {
                value = Convert.ChangeType(value, ValueType);
            }
            if (m_Value != value)
            {
                change = true;
            }
            m_Value = value;
            if (change)
            {
                status |= Gurux.Device.PropertyStates.ValueChanged;
            }
            NotifyPropertyChange(status);
        }
예제 #6
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public GXPropertyEventArgs(GXProperty prop, PropertyStates status)
     : base(prop)
 {
     Status = status;
 }
예제 #7
0
 public ChangeOfState(PropertyStates newState, StatusFlags statusFlags)
 {
     NewState    = newState;
     StatusFlags = statusFlags;
 }
예제 #8
0
 public PropertyTrackingObject(PropertyTag tag, PropertyStates state, Maybe <PropertyValue> value)
 {
     Tag   = tag;
     State = state;
     Value = value;
 }
예제 #9
0
 public PropertyTrackingObject SetState(PropertyStates value)
 {
     return(new PropertyTrackingObject(Tag, value, Value));
 }