public GridPageViewModel(CalculatorsAndStopwatchApplicationViewModel applicationViewModel) { _applicationViewModel = applicationViewModel; _navigationViewModel = new NavigationViewModel(_applicationViewModel); _items = new ReadOnlyProperty<ObservableCollection<SampleItemCollectionItem>>(new ObservableCollection<SampleItemCollectionItem>()); IEnumerable<SampleItemCollectionItem> items = new[] { new SampleItemCollectionItem(_items.Value, 2, "second", "sdkgsdgh", true), new SampleItemCollectionItem(_items.Value, 3, "third", "weuirueifsd", false), new SampleItemCollectionItem(_items.Value, 4, "fourth", "ioerhivfni", false), new SampleItemCollectionItem(_items.Value, 5, "fifth", "zdiofernwiasu", true), new SampleItemCollectionItem(_items.Value, 12, "second", "sdkgsdgh", true), new SampleItemCollectionItem(_items.Value, 13, "third", "weuirueifsd", false), new SampleItemCollectionItem(_items.Value, 14, "fourth", "ioerhivfni", false), new SampleItemCollectionItem(_items.Value, 15, "fifth", "zdiofernwiasu", true), new SampleItemCollectionItem(_items.Value, 22, "second", "sdkgsdgh", true), new SampleItemCollectionItem(_items.Value, 23, "third", "weuirueifsd", false), new SampleItemCollectionItem(_items.Value, 24, "fourth", "ioerhivfni", false), new SampleItemCollectionItem(_items.Value, 25, "fifth", "zdiofernwiasu", true), new SampleItemCollectionItem(_items.Value, 32, "second", "sdkgsdgh", true), new SampleItemCollectionItem(_items.Value, 33, "third", "weuirueifsd", false), new SampleItemCollectionItem(_items.Value, 34, "fourth", "ioerhivfni", false), new SampleItemCollectionItem(_items.Value, 35, "fifth", "zdiofernwiasu", true), new SampleItemCollectionItem(_items.Value, 42, "second", "sdkgsdgh", true), new SampleItemCollectionItem(_items.Value, 43, "third", "weuirueifsd", false), new SampleItemCollectionItem(_items.Value, 44, "fourth", "ioerhivfni", false), new SampleItemCollectionItem(_items.Value, 45, "fifth", "zdiofernwiasu", true) }; _items.Value.AddRange(items); }
public SampleItem(int id, string name, string something, bool boolean) { _id = new ReadOnlyProperty<int>(id); _name = new ReadOnlyProperty<string>(name); _something = new ReadOnlyProperty<string>(something); _boolean = new ReadOnlyProperty<bool>(boolean); }
protected CalculatorViewModelBase(bool supportsAsync) { _updateInRealTimeItems = new ObservableCollection<bool>(new[] { true, false }); _updateInRealTimeSelection = new ObservableProperty<bool?>(true); _updateInRealTime = CalculatedProperty<bool>.Create(_updateInRealTimeSelection, updateInRealTimeSelection => updateInRealTimeSelection.Value.HasValue && updateInRealTimeSelection.Value.Value); _supportsAsync = new ReadOnlyProperty<bool>(supportsAsync); _simulateLatencyItems = new ObservableCollection<bool>(new[] { true, false }); _simulateLatencySelection = new ObservableProperty<bool?>(true); _simulateLatency = CalculatedProperty<bool>.Create(_simulateLatencySelection, simulateLatencySelection => simulateLatencySelection.Value.HasValue && simulateLatencySelection.Value.Value); _operators = new ObservableCollection<Operator>(new[] { Operator.Add, Operator.Subtract, Operator.Multiply, Operator.Divide }); _operand1 = new ObservableProperty<string>(); _selectedOperator = new ObservableProperty<Operator?>(); _selectedOperator.Value = Operator.Add; _selectedOperatorString = CalculatedProperty<string>.Create(_selectedOperator, selectedOperator => { if (selectedOperator.Value == null) { return null; } switch (selectedOperator.Value.Value) { case Operator.Add: return "+"; case Operator.Subtract: return "-"; case Operator.Multiply: return "*"; case Operator.Divide: return "/"; default: throw new NotSupportedException("Unknown enum value " + selectedOperator.Value.Value + "."); } }); _operand2 = new ObservableProperty<string>(); }
public EnumDictionaryMapper(ReadOnlyProperty <T> property) { _property = property; }
public ObjectArrayDictionaryMapper(ReadOnlyProperty <T> property, IDictionaryConverter elementConverter) { _property = property; _elementConverter = elementConverter; }
public ValueDictionaryMapper(ReadOnlyProperty <T> property) { _property = property; }
public MessageLifetimeScopeIdAccessor(PropertyInfo propertyInfo) { _property = new ReadOnlyProperty <TMessage, TId>(propertyInfo); }
public LoadMessageDataPropertyProvider(IMessageDataRepository repository, PropertyInfo property) { _repository = repository; _property = new ReadOnlyProperty <TInput, MessageData <TValue> >(property); }
public ValueObjectDictionaryDictionaryMapper(ReadOnlyProperty <T> property, DictionaryConverter elementConverter) { _property = property; _elementConverter = elementConverter; }
IDictionaryMapper <T> GetDictionaryMapper(ReadOnlyProperty <T> property, Type valueType) { Type underlyingType; if (valueType.IsNullable(out underlyingType)) { var converterType = typeof(NullableValueDictionaryMapper <,>).MakeGenericType(typeof(T), underlyingType); return((IDictionaryMapper <T>)Activator.CreateInstance(converterType, property)); } if (valueType.GetTypeInfo().IsEnum) { return(new EnumDictionaryMapper <T>(property)); } if (valueType.IsArray) { var elementType = valueType.GetElementType(); if (ValueObject.IsValueObjectType(elementType)) { return(new ValueDictionaryMapper <T>(property)); } var elementConverter = _cache.GetConverter(elementType); var converterType = typeof(ObjectArrayDictionaryMapper <,>).MakeGenericType(typeof(T), elementType); return((IDictionaryMapper <T>)Activator.CreateInstance(converterType, property, elementConverter)); } if (ValueObject.IsValueObjectType(valueType)) { return(new ValueDictionaryMapper <T>(property)); } if (valueType.HasInterface(typeof(IEnumerable <>))) { var elementType = valueType.GetClosingArguments(typeof(IEnumerable <>)).Single(); if (valueType.ClosesType(typeof(IDictionary <,>))) { var arguments = valueType.GetClosingArguments(typeof(IDictionary <,>)).ToArray(); var keyType = arguments[0]; if (ValueObject.IsValueObjectType(keyType)) { elementType = arguments[1]; if (ValueObject.IsValueObjectType(elementType)) { var converterType = typeof(ValueValueDictionaryDictionaryMapper <, ,>).MakeGenericType(typeof(T), keyType, elementType); return((IDictionaryMapper <T>)Activator.CreateInstance(converterType, property)); } else { var converterType = typeof(ValueObjectDictionaryDictionaryMapper <, ,>).MakeGenericType(typeof(T), keyType, elementType); var elementConverter = _cache.GetConverter(elementType); return((IDictionaryMapper <T>)Activator.CreateInstance(converterType, property, elementConverter)); } } throw new InvalidOperationException("Unable to map a reference type key dictionary"); } if (valueType.ClosesType(typeof(IList <>)) || valueType.ClosesType(typeof(IEnumerable <>))) { var converterType = typeof(ObjectListDictionaryMapper <,>).MakeGenericType(typeof(T), elementType); var elementConverter = _cache.GetConverter(elementType); return((IDictionaryMapper <T>)Activator.CreateInstance(converterType, property, elementConverter)); } } return(new ObjectDictionaryMapper <T>(property, _cache.GetConverter(valueType))); }
public ValueListSliceProvider(PropertyInfo propertyInfo, IValueFormatter <TValue> formatter) { _formatter = formatter; _property = new ReadOnlyProperty <TEntity, ValueList <TValue> >(propertyInfo); }
public CorrelatedBySetCorrelationId() { var propertyInfo = typeof(CorrelatedBy <Guid>).GetProperty("CorrelationId"); _property = new ReadOnlyProperty <CorrelatedBy <Guid>, Guid>(propertyInfo); }
public EntityValueEntityPropertyFormatter(PropertyInfo propertyInfo, IEntityFormatter <TEntityValue> entityFormatter) { _entityFormatter = entityFormatter; _property = new ReadOnlyProperty <TEntity, Value <TEntityValue> >(propertyInfo); }
public EntityValueSliceProvider(PropertyInfo propertyInfo, IEntityMap <TComponent> entityMap) { _entityMap = entityMap; _property = new ReadOnlyProperty <TEntity, Value <TComponent> >(propertyInfo); }
public InputValueTranslatePropertyProvider(PropertyInfo propertyInfo) { _property = new ReadOnlyProperty <TInput, Value <TValue> >(propertyInfo); }
public CopyValueListPropertyTranslator(Type implementationType, PropertyInfo entityPropertyInfo, PropertyInfo inputPropertyInfo) { _property = new WriteProperty <TEntity, ValueList <TPropertyEntity> >(implementationType, entityPropertyInfo.Name); _inputProperty = new ReadOnlyProperty <TInput, ValueList <TPropertyEntity> >(inputPropertyInfo); }
public PropertySetCorrelationId(PropertyInfo propertyInfo) { _property = new ReadOnlyProperty <T, Guid>(propertyInfo); }
public ObjectDictionaryMapper(ReadOnlyProperty <T> property, IDictionaryConverter converter) { _property = property; _converter = converter; }
public ValueEntityPropertyFormatter(PropertyInfo propertyInfo, IValueFormatter <TValue> formatter) { _formatter = formatter; _property = new ReadOnlyProperty <TEntity, Value <TValue> >(propertyInfo); }
set => SetValue(ReadOnlyProperty, value);