コード例 #1
0
        /// <summary>
        /// Returns an initialized instance of the check identified by the passed in pseudo enumeration.
        /// An exception is thrown if no check with the given name exists.
        /// </summary>
        /// <returns>The initialized instance of the check.</returns>
        /// <param name="typeName">The name of the check to be instantiated.</param>
        public IDeviceCheck create(string typeName)
        {
            IDeviceCheckType securityCheckType = DeviceChecks.GetDeviceCheck(typeName);

            if (securityCheckType == null)
            {
                throw new Exception(String.Format("No device check with name {0} is known", typeName));
            }

            return(create(securityCheckType));
        }
コード例 #2
0
        /// <summary>
        /// Returns an initialized instance of the check identified by the passed in pseudo enumeration.
        /// </summary>
        /// <returns>The initialized instance of the check.</returns>
        /// <param name="type">Type of the check to be instantiated. This must be an instance of <see cref="T:AeroGear.Mobile.Security.DeviceChecks"/></param>
        public IDeviceCheck create(IDeviceCheckType type)
        {
            DeviceChecks checkType = type as DeviceChecks;

            if (checkType == null)
            {
                throw new Exception("Passed in device check type is not supported");
            }

            return(Activator.CreateInstance(checkType.CheckType, this.context) as IDeviceCheck);
        }