private ICommonProperty[] GetPatchingProperties(IHasProperties frameworkElementType, FrameworkElementPatchingType patchingType)
 {
     return(frameworkElementType.Properties
            .Where(property => property.NotContainsAttribute <NotPatchingPropertyAttribute>() &&
                   (!applicationPatcherWpfConfiguration.SkipConnectingByNameIfNameIsInvalid || nameRulesService.IsNameValid(property.Name, UseNameRulesFor.DependencyProperty)) && (
                       patchingType == FrameworkElementPatchingType.All ||
                       property.ContainsAttribute <PatchingPropertyAttribute>() ||
                       property.ContainsAttribute <ConnectPropertyToFieldAttribute>()))
            .ToArray());
 }
Пример #2
0
 private ICommonProperty[] GetPatchingProperties(IHasProperties viewModelType, IHasType commandType, ViewModelPatchingType patchingType)
 {
     return(viewModelType.Properties
            .Select(property => property)
            .Where(property => property.NotContainsAttribute <NotPatchingPropertyAttribute>() &&
                   (!applicationPatcherWpfConfiguration.SkipConnectingByNameIfNameIsInvalid || nameRulesService.IsNameValid(property.Name, UseNameRulesFor.Property)) && (
                       patchingType == ViewModelPatchingType.All && property.IsNotInheritedFrom(commandType) ||
                       property.ContainsAttribute <PatchingPropertyAttribute>() ||
                       property.ContainsAttribute <ConnectPropertyToFieldAttribute>()))
            .ToArray());
 }
 private ICommonMethod[] GetPatchingMethods(IHasMethods viewModelType, ViewModelPatchingType patchingType)
 {
     return(viewModelType.Methods
            .Where(method => method.NotContainsAttribute <NotPatchingCommandAttribute>() && method.ReturnType == typeof(void) && !method.ParameterTypes.Any() &&
                   (!applicationPatcherWpfConfiguration.SkipConnectingByNameIfNameIsInvalid || nameRulesService.IsNameValid(method.Name, UseNameRulesFor.CommandExecuteMethod)) && (
                       patchingType == ViewModelPatchingType.All ||
                       method.ContainsAttribute <PatchingCommandAttribute>() ||
                       method.ContainsAttribute <ConnectMethodToMethodAttribute>() ||
                       method.ContainsAttribute <ConnectMethodToPropertyAttribute>()))
            .ToArray());
 }
Пример #4
0
 private void CheckValidNames(IEnumerable <string> validNames, UseNameRulesFor useNameRulesFor)
 {
     validNames.ForEach(validName => nameRulesService.IsNameValid(validName, useNameRulesFor).Should().Be(true, $"Name '{validName}' is valid"));
 }