public void GetConverterForInt64() { const long Number = 3; TypeConverterProvider typeConverterProvider = new TypeConverterProvider(); var converter = typeConverterProvider.GetTypeConverter(Number.GetType()); Assert.AreEqual(typeof(NumberTypeConverter), converter.GetType()); }
public static ITypeConverterProvider FromAttributes(IEnumerable<Type> types) { var converterProvider = new TypeConverterProvider(); var defs = Extensions.GatherAttributes<TypeConverterAttribute, TypeConverterRegistration>( types, (type, attribute) => new TypeConverterRegistration(type, CreanteConverterInstance(attribute))); converterProvider.AddAll(defs); return converterProvider; }
public static ITypeConverterProvider FromAttributes(IEnumerable <Type> types) { var converterProvider = new TypeConverterProvider(); var defs = Extensions.GatherAttributes <TypeConverterAttribute, TypeConverterRegistration>( types, (type, attribute) => new TypeConverterRegistration(type, CreateConverterInstance(attribute))); converterProvider.AddAll(defs); return(converterProvider); }
private static ITypeConverterProvider GetConverterProvider() { var typeConverterProvider = new TypeConverterProvider(); var converters = new[] { new TypeConverterRegistration(typeof(Bitmap), new BitmapConverter()), new TypeConverterRegistration(typeof(Brush), new BrushConverter()), new TypeConverterRegistration(typeof(ColumnDefinitions), new ColumnDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(GridLength), new GridLengthTypeConverter()), new TypeConverterRegistration(typeof(RowDefinitions), new RowDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(Thickness), new ThicknessConverter()), }; typeConverterProvider.AddAll(converters); return typeConverterProvider; }
private static ITypeConverterProvider GetConverterProvider() { var typeConverterProvider = new TypeConverterProvider(); var converters = new[] { new TypeConverterRegistration(typeof(Bitmap), new BitmapTypeConverter()), new TypeConverterRegistration(typeof(Brush), new BrushTypeConverter()), new TypeConverterRegistration(typeof(Color), new ColorTypeConverter()), new TypeConverterRegistration(typeof(Classes), new ClassesTypeConverter()), new TypeConverterRegistration(typeof(ColumnDefinitions), new ColumnDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(GridLength), new GridLengthTypeConverter()), new TypeConverterRegistration(typeof(Point), new PointTypeConverter()), new TypeConverterRegistration(typeof(PerspexProperty), new PerspexPropertyTypeConverter()), new TypeConverterRegistration(typeof(RelativePoint), new RelativePointTypeConverter()), new TypeConverterRegistration(typeof(RowDefinitions), new RowDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(Thickness), new ThicknessTypeConverter()), new TypeConverterRegistration(typeof(Selector), new SelectorTypeConverter()), }; typeConverterProvider.AddAll(converters); return typeConverterProvider; }
private static ITypeConverterProvider GetConverterProvider() { var typeConverterProvider = new TypeConverterProvider(); var converters = new[] { new TypeConverterRegistration(typeof(IBitmap), new BitmapTypeConverter()), new TypeConverterRegistration(typeof(Brush), new BrushTypeConverter()), new TypeConverterRegistration(typeof(Color), new ColorTypeConverter()), new TypeConverterRegistration(typeof(Classes), new ClassesTypeConverter()), new TypeConverterRegistration(typeof(ColumnDefinitions), new ColumnDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(Geometry), new GeometryTypeConverter()), new TypeConverterRegistration(typeof(GridLength), new GridLengthTypeConverter()), new TypeConverterRegistration(typeof(KeyGesture), new KeyGestureConverter()), new TypeConverterRegistration(typeof(PerspexList<double>), new PerspexListTypeConverter<double>()), new TypeConverterRegistration(typeof(IMemberSelector), new MemberSelectorTypeConverter()), new TypeConverterRegistration(typeof(Point), new PointTypeConverter()), new TypeConverterRegistration(typeof(PerspexProperty), new PerspexPropertyTypeConverter()), new TypeConverterRegistration(typeof(RelativePoint), new RelativePointTypeConverter()), new TypeConverterRegistration(typeof(RelativeRect), new RelativeRectTypeConverter()), new TypeConverterRegistration(typeof(RowDefinitions), new RowDefinitionsTypeConverter()), new TypeConverterRegistration(typeof(Selector), new SelectorTypeConverter()), new TypeConverterRegistration(typeof(Thickness), new ThicknessTypeConverter()), new TypeConverterRegistration(typeof(TimeSpan), new TimeSpanTypeConverter()), new TypeConverterRegistration(typeof(Uri), new UriTypeConverter()), new TypeConverterRegistration(typeof(Cursor), new CursorTypeConverter()) }; typeConverterProvider.AddAll(converters); return typeConverterProvider; }
public DataContextChangeSynchronizerTest() { _repo = new TypeConverterProvider(); _guiObject = new SamplePerspexObject(); _viewModel = new ViewModelMock(); }