VintaSoft Twain .NET SDK 14.1: Руководство для .NET разработчика
В этом разделе
    Как работать с профилями сканера Kodak?
    В этом разделе
    SDK позволяет работать с профилями сканеров Kodak, используя класс Vintasoft.Twain.KodakDeviceProfileCollection.



    Вот C#/VB.NET код, который демонстрирует, как получить список профилей сканера Kodak:
    /// <summary>
    /// Adds the profile with specified name to the Kodak device.
    /// </summary>
    /// <param name="device">The device.</param>
    /// <param name="profileName">The profile name.</param>
    public static void AddProfile(Vintasoft.Twain.Device device, string profileName)
    {
        // create profile collection
        Vintasoft.Twain.KodakDeviceProfileCollection profiles = new Vintasoft.Twain.KodakDeviceProfileCollection(device);
    
        // create and add profile
        profiles.Add(profileName);
    }
    
    ''' <summary>
    ''' Adds the profile with specified name to the Kodak device.
    ''' </summary>
    ''' <param name="device">The device.</param>
    ''' <param name="profileName">The profile name.</param>
    Public Shared Sub AddProfile(device As Vintasoft.Twain.Device, profileName As String)
            ' create profile collection
            Dim profiles As New Vintasoft.Twain.KodakDeviceProfileCollection(device)
    
            ' create and add profile
            profiles.Add(profileName)
    End Sub
    


    Вот C#/VB.NET код, который демонстрирует, как добавить профиль к сканеру Kodak:
    /// <summary>
    /// Adds the profile with specified name to the Kodak device.
    /// </summary>
    /// <param name="device">The device.</param>
    /// <param name="profileName">The profile name.</param>
    public static void AddProfile(Vintasoft.Twain.Device device, string profileName)
    {
        // create profile collection
        Vintasoft.Twain.KodakDeviceProfileCollection profiles = new Vintasoft.Twain.KodakDeviceProfileCollection(device);
    
        // create and add profile
        profiles.Add(profileName);
    }
    
    ''' <summary>
    ''' Adds the profile with specified name to the Kodak device.
    ''' </summary>
    ''' <param name="device">The device.</param>
    ''' <param name="profileName">The profile name.</param>
    Public Shared Sub AddProfile(device As Vintasoft.Twain.Device, profileName As String)
            ' create profile collection
            Dim profiles As New Vintasoft.Twain.KodakDeviceProfileCollection(device)
    
            ' create and add profile
            profiles.Add(profileName)
    End Sub
    


    Вот C#/VB.NET код, который демонстрирует, как установить текущий профиль для сканера Kodak:
    /// <summary>
    /// Set the current device profile.
    /// </summary>
    /// <param name="device">The device.</param>
    /// <param name="profileName">The profile name.</param>
    public static void SetCurrentProfile(Vintasoft.Twain.Device device, string profileName)
    {
        // create profile collection
        Vintasoft.Twain.KodakDeviceProfileCollection profiles = new Vintasoft.Twain.KodakDeviceProfileCollection(device);
    
        // set current profile
        profiles.SetCurrentProfile(profileName);
    }
    
    ''' <summary>
    ''' Set the current device profile.
    ''' </summary>
    ''' <param name="device">The device.</param>
    ''' <param name="profileName">The profile name.</param>
    Public Shared Sub SetCurrentProfile(device As Vintasoft.Twain.Device, profileName As String)
            ' create profile collection
            Dim profiles As New Vintasoft.Twain.KodakDeviceProfileCollection(device)
    
            ' set current profile
            profiles.SetCurrentProfile(profileName)
    End Sub
    


    Вот C#/VB.NET код, который демонстрирует, как удалить профиль из сканера Kodak:
    /// <summary>
    /// Removes the profile with specified name from the device.
    /// </summary>
    /// <param name="device">The device.</param>
    /// <param name="profileName">The profile name.</param>
    public static void RemoveProfile(Vintasoft.Twain.Device device, string profileName)
    {
        // create profile collection
        Vintasoft.Twain.KodakDeviceProfileCollection profiles = new Vintasoft.Twain.KodakDeviceProfileCollection(device);
    
        // remove profile from device
        profiles.Remove(profileName);
    }
    
    ''' <summary>
    ''' Removes the profile with specified name from the device.
    ''' </summary>
    ''' <param name="device">The device.</param>
    ''' <param name="profileName">The profile name.</param>
    Public Shared Sub RemoveProfile(device As Vintasoft.Twain.Device, profileName As String)
            ' create profile collection
            Dim profiles As New Vintasoft.Twain.KodakDeviceProfileCollection(device)
    
            ' remove profile from device
            profiles.Remove(profileName)
    End Sub