public WiaDeviceManager(WiaVersion version) : base(version) { WiaException.Check(Version == WiaVersion.Wia10 ? NativeWiaMethods.GetDeviceManager1(out var handle) : NativeWiaMethods.GetDeviceManager2(out handle)); Handle = handle; }
private void InitializeWia() { if (_mySettings._settings.wiaVersion == 0) { return; } _wiaVersion = (WiaVersion)_mySettings._settings.wiaVersion; _wiaAvailable = WiaSession.IsAvailable(_wiaVersion); if (_wiaAvailable) { _wiaSession = new WiaSession(); _wiaSession.Startup(_wiaVersion); _miWiaSelectSource.Enabled = true; // Set the default acquire path for file transfer to My Documents folder. string myDocumentsPath; HelperFunctions.GetFormatFilterAndExtension(); myDocumentsPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); _wiaAcquireOptions.FileName = string.Format("{0}{1}{2}", myDocumentsPath, "\\WiaTest.", HelperFunctions.Extension); if (_wiaProperties.DataTransfer.TransferMode == WiaTransferMode.None) // GetProperties() method not called yet. { _wiatransferMode = WiaTransferMode.Memory; } else { _wiatransferMode = _wiaProperties.DataTransfer.TransferMode; } _wiaSession.AcquireEvent += new EventHandler <WiaAcquireEventArgs>(_wiaSession_AcquireEvent); } else { _miWiaSelectSource.Enabled = false; } _wiaerrorList = new ArrayList(); _enumeratedItemsList = new ArrayList(); _capabilitiesList = new ArrayList(); _formatsList = new ArrayList(); _flagValuesStrings = new ArrayList(); _wiaSourceSelected = _mySettings._settings.wiaSelectedDevice != null; if (_wiaSourceSelected) { try { _wiaSession.SelectDevice(_mySettings._settings.wiaSelectedDevice); } catch { _wiaSourceSelected = false; } } }
protected NativeWiaObject(WiaVersion version, IntPtr handle) { if (version == WiaVersion.Default) { version = DefaultWiaVersion; } Version = version; Handle = handle; }
private void _lbWiaVersions_DoubleClick(object sender, EventArgs e) { MyItemData item = (MyItemData)_lbWiaVersions.SelectedItem; if (item.ItemData == (int)WiaVersion.Version2 /* WIA version 2.0 selected */) { if (System.Environment.OSVersion.Version.Major != 6 /* Not VISTA OS */) { return; } } _selectedWiaVersion = (WiaVersion)item.ItemData; this.DialogResult = DialogResult.OK; this.Hide(); }
static void Main( ) { if (!Support.SetLicense()) { return; } using (WiaVersionForm WiaVersionDlg = new WiaVersionForm()) { if (WiaVersionDlg.ShowDialog() == DialogResult.OK) { _wiaVersion = WiaVersionDlg._selectedWiaVersion; } else { return; } } Application.Run(new MainForm()); }
private void _miWiaVersion_Click(object sender, EventArgs e) { bool bTopMost = logWindow.TopMost; logWindow.TopMost = false; try { using (WiaVersionForm WiaVersionDlg = new WiaVersionForm()) { if (WiaVersionDlg.ShowDialog() == DialogResult.OK) { _wiaVersion = WiaVersionDlg._selectedWiaVersion; _mySettings._settings.wiaVersion = (int)_wiaVersion; _mySettings.Save(); InitializeWia(); } } } catch { } logWindow.TopMost = bTopMost; }
protected internal WiaDeviceInfo(WiaVersion version, IntPtr propStorageHandle) : base(version) { Properties = new WiaPropertyCollection(version, propStorageHandle); }
protected internal WiaDeviceManager(WiaVersion version, IntPtr handle) : base(version, handle) { }
protected internal WiaItemBase(WiaVersion version, IntPtr handle) : base(version, handle) { }
protected NativeWiaObject(WiaVersion version) : this(version, IntPtr.Zero) { }
protected internal WiaPropertyCollection(WiaVersion version, IntPtr propertyStorageHandle) : base(version, propertyStorageHandle) { _propertyDict = new Dictionary <int, WiaProperty>(); WiaException.Check(NativeWiaMethods.EnumerateProperties(Handle, (id, name, type) => _propertyDict.Add(id, new WiaProperty(Handle, id, name, type)))); }
private void _btnOk_Click(object sender, EventArgs e) { MyItemData item = (MyItemData)_lbWiaVersions.SelectedItem; _selectedWiaVersion = (WiaVersion)item.ItemData; }
protected internal WiaTransfer(WiaVersion version, IntPtr handle) : base(version, handle) { }