예제 #1
0
        /// <summary>
        /// Sets the value of a styled property.
        /// </summary>
        /// <param name="property">The property.</param>
        /// <param name="value">The value.</param>
        /// <param name="priority">The priority of the value.</param>
        private void SetStyledValue(AvaloniaProperty property, object value, BindingPriority priority)
        {
            var notification = value as BindingNotification;

            // We currently accept BindingNotifications for non-direct properties but we just
            // strip them to their underlying value.
            if (notification != null)
            {
                if (!notification.HasValue)
                {
                    return;
                }
                else
                {
                    value = notification.Value;
                }
            }

            var originalValue = value;

            if (!TypeUtilities.TryConvertImplicit(property.PropertyType, value, out value))
            {
                throw new ArgumentException(string.Format(
                                                "Invalid value for Property '{0}': '{1}' ({2})",
                                                property.Name,
                                                originalValue,
                                                originalValue?.GetType().FullName ?? "(null)"));
            }

            LogPropertySet(property, value, priority);
            Values.AddValue(property, value, (int)priority);
        }
예제 #2
0
 /// <summary>
 /// Parameter의 값을 설정한다.
 /// </summary>
 /// <param name="args"></param>
 public virtual void AddValue(params object[] args)
 {
     if (args != null && args.Length > 0)
     {
         Values.AddValue(args);
     }
 }
예제 #3
0
파일: Plotter.cs 프로젝트: Jango73/Powerlog
        /// <summary>
        ///
        /// </summary>
        /// <param name="aValue"></param>
        public void AddValue(String aName, LogValue aValue)
        {
            lock (this)
            {
                m_Dirty = true;

                if (m_Time == DateTime.MinValue)
                {
                    m_Time = aValue.Time;
                }

                foreach (PlotterValues Values in m_Values)
                {
                    if (Values.Name == aName)
                    {
                        Values.AddValue(aValue);
                        return;
                    }
                }

                // Not found, add the value
                PlotterValues NewValues = new PlotterValues(aName);
                NewValues.AddValue(aValue);
                m_Values.Add(NewValues);
            }
        }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     for (int i = 0; i < 10; i++)
     {
         //Values.AddValue("int_" + i, Values.StatusValue.INT, ((value) => value.value = _int), ((object obj) => _int = int.Parse(obj.ToString())));
         Values.AddValue("int_" + i, Values.StatusValue.INT, ((value) => value.value = _int), ((int value) => { Debug.Log("value = " + value); _int = value; }));
         Values.AddValue("double_" + i, Values.StatusValue.DOUBLE, ((value) => value.value = _double), ((double value) => _double = value));
         Values.AddValue("string_" + i, Values.StatusValue.STRING, ((value) => value.value = _string), ((string value) => _string = value));
         Values.AddValue("v2_" + i, Values.StatusValue.VECTOR2, ((value) => value.value = _v2), ((Vector2 value) => _v2 = value));
         Values.AddValue("v3_" + i, Values.StatusValue.VECTOR3, ((value) => value.value = _v3), ((Vector3 value) => _v3 = value));
         Values.AddValue("v4_" + i, Values.StatusValue.VECTOR4, ((value) => value.value = _v4), ((Vector4 value) => _v4 = value));
         Values.AddValue("quat_" + i, Values.StatusValue.VECTOR4, ((value) => value.value = _quat), ((Quaternion value) => _quat = value));
     }
 }
예제 #5
0
        /// <summary>
        /// 이차원 배열의 Arguement를 넣는다.
        /// 새로운 인자집합을 가진 Value 객체를 만들고 그것을 ValueCollection객체에 넣는다.
        /// </summary>
        /// <param paramName="args">argument set</param>
        public virtual void AddValueArray(params object[][] args)
        {
            if (args == null || !args.GetType().IsArray)
            {
                return;
            }

            int rank = args.Rank;
            int dims = args.GetLength(rank - 1);

            for (int i = 0; i < dims; i++)
            {
                Values.AddValue(args[i]);
            }
        }