예제 #1
0
 /// <summary>
 /// Searches for a convention that applies on <paramref name="instance"/> object and <paramref name="propertyName"/>
 /// </summary>
 public IPropertyConvention Convention(ViewModelBase instance, String propertyName)
 {
     var customConvention = conventions.SingleOrDefault(c => c.Applies(instance.GetType(), propertyName));
     if (customConvention != null)
     {
         return customConvention;
     }
     throw new ArgumentException("Convention for requested type was not found. Probable reasons are: it Applies() method not functioning properly, or several conventions is applicable and caused a collision");
 }
예제 #2
0
 public void SetParent(ViewModelBase parent)
 {
     OnParentSet(parent);
     Parent = parent;
 }
예제 #3
0
 private void OnParentSet(ViewModelBase newParentValue)
 {
     if (newParentValue.Equals(this))
     {
         throw new ArgumentException("Can't set Parent property to itself");
     }
 }
예제 #4
0
 public virtual void SetViewModel(ViewModelBase viewModelInstance)
 {
     if (viewModelInstance != null)
     {
         viewModel = viewModelInstance;
         SubscribeViewModelToCanExecuteChange();
     }
     else
     {
         throw new ArgumentException("viewModelInstance parameter should not be null");
     }
 }