Ejemplo n.º 1
0
        internal TwainCapabilities(Twain32 twain)
        {
            MethodInfo _сreateCapability = typeof(TwainCapabilities).GetMethod("CreateCapability", BindingFlags.Instance | BindingFlags.NonPublic);

            foreach (PropertyInfo _prop in typeof(TwainCapabilities).GetProperties())
            {
                object[] _attrs = _prop.GetCustomAttributes(typeof(CapabilityAttribute), false);
                if (_attrs.Length > 0)
                {
                    CapabilityAttribute _attr = _attrs[0] as CapabilityAttribute;
                    _prop.SetValue(this, _сreateCapability.MakeGenericMethod(_prop.PropertyType.GetGenericArguments()[0]).Invoke(this, new object[] { twain, _attr.Cap }), null);
                }
            }
        }
Ejemplo n.º 2
0
 public ScannerManager()
 {
     _twain32 = new Twain32();
     _twain32.AppProductName = ConfigurationManager.PROGRAM_NAME;
     _twain32.ShowUI         = false;
 }
Ejemplo n.º 3
0
 private Capability <T> CreateCapability <T>(Twain32 twain, TwCap cap) where T : struct
 {
     return(Activator.CreateInstance(typeof(Capability <T>), new object[] { twain, cap }) as Capability <T>);
 }
Ejemplo n.º 4
0
 public Capability(Twain32 twain, TwCap cap)
 {
     this._Twain32 = twain;
     this._Cap     = cap;
 }