public CallbackController(ILogin _ILogin, ICommonMethod ICommonMethod)
 {
     this._ILogin        = _ILogin;
     this._ICommonMethod = ICommonMethod;
 }
 // GET: eFleetDriver
 public eFleetDriverController(BusinessLogic.IDriverEfleet _IEfleetDriver, ICommonMethod _ICommonMethod)
 {
     this._IEfleetDriver = _IEfleetDriver;
     this._ICommonMethod = _ICommonMethod;
 }
 private static (ICommonMethod ExecuteMethod, List <ICommonMethod> CanExecuteMethods, List <ICommonProperty> Properties, List <ICommonField> Fields) CreateEmptyPatchingCommandGroup(ICommonMethod executeMethod)
 {
     return(executeMethod, new List <ICommonMethod>(), new List <ICommonProperty>(), new List <ICommonField>());
 }
 public static bool NotContainsReflectionAttribute(this ICommonMethod commonMethod, IHasType attributeHasType)
 {
     return(!commonMethod.ContainsReflectionAttribute(attributeHasType));
 }
Example #5
0
        private void GenerateGetMethodBody(ICommonAssembly assembly, ICommonType viewModelType, ICommonMethod executeMethod, ICommonMethod canExecuteMethod, PropertyDefinition property, FieldReference field)
        {
            log.Info("Generate get method body...");

            if (property.GetMethod == null)
            {
                log.Debug($"Create get accessor method for property '{property.Name}'");
                var getMethod = new MethodDefinition($"get_{property.Name}", MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.SpecialName, property.PropertyType);

                property.GetMethod = getMethod;
                viewModelType.MonoCecil.Methods.Add(getMethod);
            }

            var returnInstruction = Instruction.Create(OpCodes.Ret);

            property.GetMethod.Body.Variables.Clear();
            property.GetMethod.Body.InitLocals = true;
            property.GetMethod.Body.Variables.Add(new VariableDefinition(assembly.MonoCecil.MainModule.ImportReference(commandType.GetValue(assembly).MonoCecil)));

            property.GetMethod.Body.Instructions.Clear();
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldfld, field));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Dup));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Brtrue_S, returnInstruction));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Pop));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldftn, executeMethod.MonoCecil));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, actionConstructor.GetValue(assembly)));

            if (canExecuteMethod == null)
            {
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, relayCommandConstructor.GetValue(assembly)));
            }
            else
            {
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldftn, canExecuteMethod.MonoCecil));
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, funcBoolConstructor.GetValue(assembly)));
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldc_I4_0));
                property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Newobj, relayCommandConstructorWithCanExecuteMethod.GetValue(assembly)));
            }

            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Dup));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Stloc_0));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Stfld, field));
            property.GetMethod.Body.Instructions.Add(Instruction.Create(OpCodes.Ldloc_0));
            property.GetMethod.Body.Instructions.Add(returnInstruction);

            property.GetMethod.RemoveAttributes <CompilerGeneratedAttribute>();

            log.Info("Get method body was generated");
        }
 public static bool ContainsReflectionAttribute(this ICommonMethod commonMethod, Type attributeType)
 {
     return(commonMethod.Reflection.GetCustomAttributes(attributeType, false).Any());
 }
 public static bool NotContainsReflectionAttribute <TAttribute>(this ICommonMethod commonMethod) where TAttribute : Attribute
 {
     return(!commonMethod.ContainsReflectionAttribute <TAttribute>());
 }
 public static Attribute GetReflectionAttribute(this ICommonMethod commonMethod, Type attributeType, bool throwExceptionIfNotFound = false)
 {
     return((Attribute)commonMethod.Reflection.GetCustomAttributes(attributeType, false).SingleOrDefault(throwExceptionIfNotFound, attributeType.FullName));
 }
 public static bool ContainsReflectionAttribute <TAttribute>(this ICommonMethod commonMethod) where TAttribute : Attribute
 {
     return(commonMethod.ContainsReflectionAttribute(typeof(TAttribute)));
 }
 public static TAttribute GetReflectionAttribute <TAttribute>(this ICommonMethod commonMethod, bool throwExceptionIfNotFound = false) where TAttribute : Attribute
 {
     return((TAttribute)commonMethod.GetReflectionAttribute(typeof(TAttribute), throwExceptionIfNotFound));
 }
 public static bool TryGetReflectionAttribute <TAttribute>(this ICommonMethod commonMethod, out TAttribute foundAttribute) where TAttribute : Attribute
 {
     return((foundAttribute = commonMethod.GetReflectionAttribute <TAttribute>()) != null);
 }
 public static IEnumerable <TAttribute> GetReflectionAttributes <TAttribute>(this ICommonMethod commonMethod) where TAttribute : Attribute
 {
     return(commonMethod.Reflection.GetCustomAttributes <TAttribute>(false));
 }
Example #13
0
        //private string PWDGUIDMaxLength = ConfigurationManager.AppSettings["PWDGUIDMaxLength"];
        //int pwdmaxlendth = 10;

        public AdministratorController(ICommonMethod _ICommonMethod, IGlobalAdmin _IGlobalAdmin, IClientManager _IClientManager)
        {
            this._ICommonMethod = _ICommonMethod; this._IGlobalAdmin = _IGlobalAdmin; this._IClientManager = _IClientManager;
        }
 public NewAdminController(IDepartment _IDepartment, IGlobalAdmin _GlobalAdminManager, ICommonMethod _ICommonMethod, IQRCSetup _IQRCSetup)
 {
     this._IDepartment        = _IDepartment;
     this._GlobalAdminManager = _GlobalAdminManager;
     this._ICommonMethod      = _ICommonMethod;
     this._IQRCSetup          = _IQRCSetup;
 }