VintaSoft Twain .NET SDK 15.0: Documentation for .NET developer
In This Topic
    SANE devices
    In This Topic
    SANE device manager allows to get the device list programmatically. Device list can be obtained using SaneLocalDeviceManager.Devices property. Information about an opened device can be obtained using SaneLocalDeviceManager.OpenedDevice property.


    Here is an example that demonstrates how to open SANE device manager and display information about all available SANE devices:
    /// <summary>
    /// Opens SANE device manager and displays information about available local SANE image scanners.
    /// </summary>
    void GetSaneDevicesInfo()
    {
        // create SANE device manager
        using (Vintasoft.Sane.SaneLocalDeviceManager deviceManager = new Vintasoft.Sane.SaneLocalDeviceManager())
        {
            // open device manager
            deviceManager.Open();
    
            Vintasoft.Sane.SaneLocalDeviceCollection devices = deviceManager.Devices;
            // for each SANE device
            for (int i = 0; i < devices.Count; i++)
            {
                // output the device name
                System.Console.WriteLine(string.Format("Device '{0}'", devices[i].Name));
            }
        }
    }
    
    ''' <summary>
    ''' Opens SANE device manager and displays information about available local SANE image scanners.
    ''' </summary>
    Private Sub GetSaneDevicesInfo()
            ' create SANE device manager
            Using deviceManager As New Vintasoft.Sane.SaneLocalDeviceManager()
                    ' open device manager
                    deviceManager.Open()
    
                    Dim devices As Vintasoft.Sane.SaneLocalDeviceCollection = deviceManager.Devices
                    ' for each SANE device
                    For i As Integer = 0 To devices.Count - 1
                            ' output the device name
                            System.Console.WriteLine(String.Format("Device '{0}'", devices(i).Name))
                    Next
            End Using
    End Sub