VintaSoft Twain .NET SDK 15.4: Руководство для .NET разработчика
В этом разделе
Как создать предопределенную настройку сеанса для высоко-скоростного TWAIN сканера?
В этом разделе
SDK позволяет загружать/сохранять предопределенные настройки сеансов для средне- и высоко-скоростных TWAIN сканеров.


Вот C#/VB.NET код, который демонстрирует, как сохранить текущие настройки TWAIN устройства в XML-файл:
/// <summary>
/// Saves the device settings.
/// </summary>
public void SaveDeviceSettings(Vintasoft.Twain.Device device)
{
    // open the device
    device.Open();

    using (System.IO.FileStream fs = new System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write))
    {
        device.SaveSettings(fs);
    }
}
''' <summary>
''' Saves the device settings.
''' </summary>
Public Sub SaveDeviceSettings(device As Vintasoft.Twain.Device)
    ' open the device
    device.Open()

    Using fs As New System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write)
        device.SaveSettings(fs)
    End Using
End Sub


Вот C#/VB.NET код, который демонстрирует, как загрузить в TWAIN устройство ранее сохраненные настройки устройства:
/// <summary>
/// Loads the device settings.
/// </summary>
public void LoadDeviceSettings(Vintasoft.Twain.Device device)
{
    // open the device
    device.Open();

    using (System.IO.FileStream fs = new System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
    {
        device.LoadSettings(fs);
    }
}
''' <summary>
''' Loads the device settings.
''' </summary>
Public Sub LoadDeviceSettings(device As Vintasoft.Twain.Device)
    ' open the device
    device.Open()

    Using fs As New System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read)
        device.LoadSettings(fs)
    End Using
End Sub