public DataSource(TwainDevice twain, TwIdentity identity)
 {
   fTwain = twain;
   fIdent = identity;
   fState = StateType.Closed;
   fSettings = null;
   fCapabilities = null;
 }
 public TwainDataSourceManager()
 {
   System.Windows.Forms.Form F = new System.Windows.Forms.Form();
   fTwain = new TwainDevice(F.Handle);
 }
      public TwainCapability(TwainDevice twain, TwIdentity dataSourceId, TwCap capType)
      {
        fTwain = twain;
        fDataSourceId = dataSourceId;
        fCapType = capType;
        fValueType = TwType.DontCare16;

        TwCapability cap = new TwCapability(capType);

        if(fTwain.GetDataSourceAvailableCapabilityValues(dataSourceId, cap))
        {
          fValueType = cap.GetValueType();

          Items = new List<object>();

          int numItems = cap.GetNumItems();

          for(int i = 0; i < numItems; i++)
          {
            Items.Add(cap.GetItem(i));
          }

          MinValue = cap.GetMinValue();
          MaxValue = cap.GetMaxValue();
          StepSize = cap.GetStepSize();
          fCurrentValue = cap.GetCurrentValue();
        }
      }