Skip to content

Commit

Permalink
Visual Studio is literally the worst thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
anaisbetts committed Nov 13, 2012
1 parent c72d270 commit ee798b7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ReactiveUI/BindingTypeConverters.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public int GetAffinityForObjects(Type lhs, Type rhs)
return 0;
}

public object ConvertObjectToType(object from, Type toType, object conversionHint)
public object Convert(object from, Type toType, object conversionHint)
{
return Convert.ChangeType(from, toType);
return System.Convert.ChangeType(from, toType);
}
}

Expand All @@ -40,7 +40,7 @@ public int GetAffinityForObjects(Type lhs, Type rhs)
return typeConverterCache.Get(Tuple.Create(lhs, rhs)) != null ? 10 : 0;
}

public object ConvertObjectToType(object from, Type toType, object conversionHint)
public object Convert(object from, Type toType, object conversionHint)
{
var fromType = from.GetType();
var converter = typeConverterCache.Get(Tuple.Create(fromType, toType));
Expand Down
10 changes: 5 additions & 5 deletions ReactiveUI/PropertyBinding.cs
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,14 @@ public IDisposable Bind<TViewModel, TView, TVMProp, TVProp, TDontCare>(
}
if (isVm) {
var vmAsView = (TVProp)vmToViewConverter.ConvertObjectToType(vmValue, typeof (TVProp), conversionHint);
var vmAsView = (TVProp)vmToViewConverter.Convert(vmValue, typeof (TVProp), conversionHint);
var changed = EqualityComparer<TVProp>.Default.Equals(vValue, vmAsView) != true;
if (!changed) return null;
this.Log().Info(vmChangedString + (vmAsView != null ? vmAsView.ToString() : "(null)"));
return Tuple.Create((object)vmAsView, isVm);
} else {
var vAsViewModel = (TVMProp)viewToVMConverter.ConvertObjectToType(vValue, typeof (TVMProp), conversionHint);
var vAsViewModel = (TVMProp)viewToVMConverter.Convert(vValue, typeof (TVMProp), conversionHint);
var changed = EqualityComparer<TVMProp>.Default.Equals(vmValue, vAsViewModel) != true;
if (!changed) return null;
Expand Down Expand Up @@ -290,7 +290,7 @@ public IDisposable OneWayBind<TViewModel, TView, TVMProp, TVProp>(
}

return Reflection.ViewModelWhenAnyValue(viewModel, view, vmProperty)
.Select(x => converter.ConvertObjectToType(x, viewType, conversionHint))
.Select(x => converter.Convert(x, viewType, conversionHint))
.Subscribe(x => Reflection.SetValueToPropertyChain(view, viewPropChain, x, false));
} else {
var converter = getConverterForTypes(typeof (TVMProp), typeof (TVProp));
Expand All @@ -300,8 +300,8 @@ public IDisposable OneWayBind<TViewModel, TView, TVMProp, TVProp>(
}

return Reflection.ViewModelWhenAnyValue(viewModel, view, vmProperty)
.Select(x => (TVProp)converter.ConvertObjectToType(x, typeof(TVProp), conversionHint))
.BindTo(view, viewProperty, () => (TVProp)converter.ConvertObjectToType(fallbackValue(), typeof(TVProp), conversionHint));
.Select(x => (TVProp)converter.Convert(x, typeof(TVProp), conversionHint))
.BindTo(view, viewProperty, () => (TVProp)converter.Convert(fallbackValue(), typeof(TVProp), conversionHint));
}
}

Expand Down

0 comments on commit ee798b7

Please sign in to comment.