public ProfileCollectionPropertyViewModel(IProfileProperty profileProperty)
        {
            Name = profileProperty.PropertyName;
            Type = profileProperty.PropertyType;

            values = CreateObservableCollection(profileProperty);
        }
Exemple #2
0
        internal ProfilePropertyWindow(Window parentWindow, IProfileProperty profileProperty)
            : base(parentWindow)
        {
            InitializeComponent();

            ProfileProperty = new PropertyViewModel(profileProperty.PropertyName, profileProperty.PropertyType, profileProperty.PropertyValue);
        }
Exemple #3
0
 public void AddProperty(IProfileProperty prop)
 {
     if (!properties.ContainsKey(prop.Name))
     {
         properties.Add(prop.Name, prop);
     }
 }
Exemple #4
0
 public void SetUp()
 {
     profileProperty = Substitute.For <IProfileProperty>();
     profileProperty.PropertyName.Returns("Foo");
     profileProperty.PropertyType.Returns(typeof(string[]));
     profileProperty.PropertyValue = new[] { "Wibble", "Wobble" };
     profileCollectionProperty     = new ProfileCollectionPropertyViewModel(profileProperty);
     ((ObservableCollection <IProfileProperty>)profileCollectionProperty.Values)[0].PropertyValue = "Dibble";
 }
Exemple #5
0
        internal ProfileCollectionPropertyWindow(Window parentWindow, IProfileProperty profileProperty)
            : base(parentWindow)
        {
            this.profileProperty = profileProperty;

            InitializeComponent();

            ProfileCollectionProperty = new ProfileCollectionPropertyViewModel(profileProperty);
        }
        public void Should_expose_all_the_data(Type dataType, bool isSupported)
        {
            profileProperty = Substitute.For <IProfileProperty>();
            profileProperty.PropertyType.Returns(Array.CreateInstance(dataType, 0).GetType());

            profileCollectionProperty = new ProfileCollectionPropertyViewModel(profileProperty);

            profileCollectionProperty.IsSupportedDataType.Should().Be(isSupported);
        }
Exemple #7
0
        public static IObjectProperty Create(IProfileProperty from, IProfileProperty to, object value)
        {
            var prop = new ObjectProperty();

            prop.from  = from;
            prop.to    = to;
            prop.value = value;

            return(prop);
        }
Exemple #8
0
        public static PropertyMapItem Create(string name, IProfileProperty from, IProfileProperty to)
        {
            var map = new PropertyMapItem();

            map.name = name;
            map.to   = to;
            map.from = from;

            return(map);
        }
        private ObservableCollection <IProfileProperty> CreateObservableCollection(IProfileProperty profileProperty)
        {
            if (profileProperty.PropertyValue == null)
            {
                return(new ObservableCollection <IProfileProperty>());
            }

            var v = (Array)profileProperty.PropertyValue;

            return(new ObservableCollection <IProfileProperty>(v.Cast <object>().Select(x => new InstanceProfileProperty(x))));
        }
 private static bool IsNumber(IProfileProperty value)
 {
     if (value.PropertyType == typeof(sbyte))
     {
         return(true);
     }
     if (value.PropertyType == typeof(byte))
     {
         return(true);
     }
     if (value.PropertyType == typeof(short))
     {
         return(true);
     }
     if (value.PropertyType == typeof(ushort))
     {
         return(true);
     }
     if (value.PropertyType == typeof(int))
     {
         return(true);
     }
     if (value.PropertyType == typeof(uint))
     {
         return(true);
     }
     if (value.PropertyType == typeof(long))
     {
         return(true);
     }
     if (value.PropertyType == typeof(ulong))
     {
         return(true);
     }
     if (value.PropertyType == typeof(float))
     {
         return(true);
     }
     if (value.PropertyType == typeof(double))
     {
         return(true);
     }
     if (value.PropertyType == typeof(decimal))
     {
         return(true);
     }
     return(false);
 }
 private bool IsSupportedEnumerable(IProfileProperty profileProperty)
 {
     return(profileProperty.PropertyType.IsArray);
 }
 public void RemoveItem(IProfileProperty item)
 {
     values.Remove(item);
 }