Esempio n. 1
0
 public CScannerAPI(CScanSettings settings)
 {
     this.settings = settings;
     DeviceManager manager = new DeviceManagerClass();
     foreach (DeviceInfo info in manager.DeviceInfos)
     {
         if (info.DeviceID == settings.DeviceID)
         {
             device = info.Connect();
             return;
         }
     }
     throw new Exceptions.EScannerNotFound();
 }
        public CScannerAPI(CScanSettings settings)
        {
            this.settings = settings;
            DeviceManager manager = new DeviceManagerClass();

            foreach (DeviceInfo info in manager.DeviceInfos)
            {
                if (info.DeviceID == settings.DeviceID)
                {
                    device = info.Connect();
                    return;
                }
            }
            throw new Exceptions.EScannerNotFound();
        }
Esempio n. 3
0
        private void scanWIA(CScanSettings Profile)
        {
            CWIAAPI api;

            try
            {
                api = new CWIAAPI(Profile);
            }
            catch (Exceptions.EScannerNotFound)
            {
                MessageBox.Show("Device not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            CScannedImage img = api.GetImage();

            if (img != null)
            {
                int next = images.Count > 0 ? images.Keys[images.Count - 1] + 1 : 0;
                images.Add(next, img);
            }
            thumbnailList1.UpdateImages(images);
            Application.DoEvents();

            if (Profile.Source != CScanSettings.ScanSource.GLASS)
            {
                while (img != null)
                {
                    img = api.GetImage();
                    if (img != null)
                    {
                        int next = images.Count > 0 ? images.Keys[images.Count - 1] + 1 : 0;
                        images.Add(next, img);
                    }
                    thumbnailList1.UpdateImages(images);
                    Application.DoEvents();
                }
            }
        }
Esempio n. 4
0
 private void lvProfiles_ItemActivate(object sender, EventArgs e)
 {
     profile = settings[lvProfiles.SelectedItems[0].Index];
     this.Close();
 }