This project has moved and is read-only. For the latest updates, please go here.

Inform: FeederLoaded

Nov 19, 2014 at 9:24 AM
hello,
is it possible to inform me whether the state of the feeder has it changed?
Or do I have the query in a permanent loop?

Me._twain32.GetCap(TwCap.FeederLoaded)
Nov 19, 2014 at 2:05 PM
Hello, abehrendt!
Is necessary to do in a loop. In practice, it is better to do in the event handler from the timer.
Marked as answer by SARAFF on 11/26/2014 at 10:31 AM
Nov 19, 2014 at 2:48 PM
can you give a sample for the event handler?
Nov 19, 2014 at 5:17 PM
Hello, abehrendt!
private System.Windows.Forms.Timer timer1;

private void InitializeComponent() {
    // ...
    this.timer1 = new System.Windows.Forms.Timer(this.components);
    // ...
    // 
    // timer1
    // 
    this.timer1.Enabled = true;
    this.timer1.Interval = 1000;
    this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
    // ...
}

private bool _isDataSourceOpen=false;

private void _twain_TwainStateChanged(object sender,Twain32.TwainStateEventArgs e) {
    try {
        // ...
        this._isDataSourceOpen=(e.TwainState&Twain32.TwainStateFlag.DSOpen)!=0;
        // ...
    } catch(Exception ex) {
        // ...
    }
}

private void timer1_Tick(object sender,EventArgs e) {
    try {
        if(this._isDataSourceOpen) {
            // ...
            var _isFeederLoaded=(bool)this._twain.GetCurrentCap(TwCap.FeederLoaded);
            // ...
        }
    } catch(Exception ex) {
        // ...
    }

}