Quantcast
Channel: Saraff.Twain.NET
Viewing all articles
Browse latest Browse all 419

Updated Wiki: Alternative User Interfaces

$
0
0

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);
    }
}

privatevoid 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);
    }
}

Viewing all articles
Browse latest Browse all 419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>