public static void UpdateAll(object model, DependencyObject view) { foreach (var member in FacadeType.Create(view.GetType(), model.GetType()).Members) { member.UpdateFrom(model, view); } }
public static void Update(object model, DependencyObject view, DependencyPropertyChangedEventArgs change) { FacadeMapping member; if (FacadeType.Create(view.GetType(), model.GetType()).ByViewProperty.TryGetValue(change.Property, out member)) { member.Update(model, change.NewValue); } }
public static FacadeType Create(Type viewType, Type modelType) { var key = Tuple.Create(viewType, modelType); FacadeType facadeType; if (!All.TryGetValue(key, out facadeType)) { All[key] = facadeType = new FacadeType(viewType, modelType); } return(facadeType); }