Exemple #1
0
        private void chooseWIA()
        {
            string devID;

            try
            {
                devID = CWIAAPI.SelectDeviceUI();
            }
            catch (Exceptions.ENoScannerFound)
            {
                MessageBox.Show("No device found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            CWIAAPI api = new CWIAAPI(devID);

            txtDevice.Text  = api.DeviceName;
            currentDeviceID = devID;
        }
Exemple #2
0
        private void loadWIA()
        {
            currentDeviceID = ScanSettings.DeviceID;
            CWIAAPI api;

            try
            {
                api = new CWIAAPI(ScanSettings.DeviceID);
            }
            catch (Exceptions.EScannerNotFound)
            {
                MessageBox.Show("Device not found.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ScanSettings.DeviceID = "";
                currentDeviceID       = "";
                txtDevice.Text        = "";
                return;
            }
            txtDevice.Text = api.DeviceName;
        }
        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();
                }
            }
        }