View on GitHub

SARAFF SOFTWARE

All products / Saraff.Twain.DS / Contents

OnProcessRequest

Invoked to processing a TWAIN operations (Triplets).

Syntax

protected virtual TwRC OnProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data)

Parameters

Return Value

TWAIN Return Codes.

Examples

protected override TwRC OnProcessRequest(TwDG dg, TwDAT dat, TwMSG msg, IntPtr data) {
    if(dg==TwDG.Image) {
        switch(dat) {
            case TwDAT.ImageLayout:
                return this._ImageLayoutProcessRequest(msg, data);
            case TwDAT.ImageInfo:
                if((this.State&DataSourceState.Ready)!=0) {
                    return this._ImageInfoProcessRequest(msg, data);
                }
                throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
            case TwDAT.ImageNativeXfer:
                if((this.State&DataSourceState.Ready)!=0) {
                    return this._ImageNativeXferProcessRequest(msg, data);
                }
                throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
            case TwDAT.ImageMemXfer:
                if((this.State&DataSourceState.Ready)!=0) {
                    return this._ImageMemXferProcessRequest(msg, data, false);
                }
                throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
            case TwDAT.ImageMemFileXfer:
                if((this.State&DataSourceState.Ready)!=0) {
                    return this._ImageMemXferProcessRequest(msg, data, true);
                }
                throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
            case TwDAT.ImageFileXfer:
                if((this.State&DataSourceState.Ready)!=0) {
                    return this._ImageFileXferProcessRequest(msg);
                }
                throw new DataSourceException(TwRC.Failure, TwCC.SeqError);
        }
    }
    return base.OnProcessRequest(dg, dat, msg, data);
}