This project has moved. For the latest updates, please go here.

Alternative User Interfaces

The following properties and methods provide an opportunity to implement an alternative user interface:
  • bool ShowUI - True if DS should bring up its UI
  • int SourcesCount - Get count of DS
  • int SourceIndex - Get or set current DS
  • string GetSourceProductName(int) - Return DS name, e.g. "ScanJet Plus"
  • Twain32.Identity GetSourceIdentity(int) - Return DS name, Family, Manufacturer, Version and ProtocolVersion.
  • bool GetIsSourceTwain2Compatible(int) - Return true if DS support TWAIN 2.x
  • void SetDefaultSource(int) - Set default DS. Only TWAIN 2.x supported
Below is an example of their use.
this._twain32.ShowUI = false;

public Form1() {
    InitializeComponent();
    try {
        this._twain32.OpenDSM();

        #region Fill DS list

        this.dataSourcesToolStripComboBox.Items.Clear();
        for(int i=0;i<this._twain32.SourcesCount;i++) {
            this.dataSourcesToolStripComboBox.Items.Add(this._twain32.GetSourceProductName(i));
        }
        if(this._twain32.SourcesCount>0) {
            this.dataSourcesToolStripComboBox.SelectedIndex=this._twain32.SourceIndex;
        }

        #endregion

    } catch(Exception ex) {
        MessageBox.Show(ex.Message,"SAMPLE2",MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
}

private void dataSourcesToolStripComboBox_SelectedIndexChanged(object sender,EventArgs e) {
    try {
        this._twain32.CloseDataSource();
        this._twain32.SourceIndex=this.dataSourcesToolStripComboBox.SelectedIndex;
        this._twain32.OpenDataSource();

        // ...

    } catch(Exception ex) {
        MessageBox.Show(ex.Message,ex.GetType().Name,MessageBoxButtons.OK,MessageBoxIcon.Error);
    }
}

Last edited Jun 8, 2016 at 5:26 PM by SARAFF, version 4