private List<Scaner> GetScanersList() { List<Scaner> ls = new List<Scaner>(); Scaner s; try { Twain _twain = new Twain(_wh); if (_twain.SourceNames.Count != 0) { _twain.SelectSource(); s = new Scaner(_twain.DefaultSourceName, EnumScanerType.Twain, _wh); ls.Add(s); } } catch (TwainException) { } List<string> devices = WIAScanner.GetDevices(); foreach (string device in devices) { s = new Scaner(device, EnumScanerType.WIA, _wh); ls.Add(s); } s = new Scaner("Изображение из файла", EnumScanerType.File, _wh); ls.Add(s); return ls; }
private List <Scaner> GetScanersList() { List <Scaner> ls = new List <Scaner>(); Scaner s; try { Twain _twain = new Twain(_wh); if (_twain.SourceNames.Count != 0) { _twain.SelectSource(); s = new Scaner(_twain.DefaultSourceName, EnumScanerType.Twain, _wh); ls.Add(s); } } catch (TwainException) { } List <string> devices = WIAScanner.GetDevices(); foreach (string device in devices) { s = new Scaner(device, EnumScanerType.WIA, _wh); ls.Add(s); } s = new Scaner("Изображение из файла", EnumScanerType.File, _wh); ls.Add(s); return(ls); }
private void lst_devices_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e) { if (lst_devices.SelectedItems.Count != 0) { Scaner s = new Scaner(lst_devices.SelectedItems[0].Text, Scaner.StringToScanerType(lst_devices.SelectedItems[0].SubItems[1].Text), new WinFormsWindowMessageHook(this)); _selectedscaner = s; } }
void btn_done_Click(object sender, EventArgs e) { _currentscaner = fs.SelectedScaner; if (_currentscaner != null) { fs.Close(); SaveScaner(); } }
public void GetDevicefromBase() { int scancount = _ge.scaners.Count(sc => sc.ids == 1); if (scancount == 0) { SelectDevice(); } else { scaner s = _ge.scaners.First(sc => sc.ids == 1); _currentscaner = new Scaner(s.currentscanername, Scaner.StringToScanerType(s.driver), _wh); } }