Updated with suggestion from #63.

This commit is contained in:
Eugene Wang 2016-03-23 06:06:39 -04:00
parent 7659c6ac95
commit 0e3d7fd1e9
4 changed files with 21 additions and 1 deletions

View File

@ -94,6 +94,15 @@ namespace NTwain
/// </value>
bool StopOnTransferError { get; set; }
/// <summary>
/// Gets the reason a source was disabled (dropped from state 5) if it's due to user action.
/// Mostly only <see cref="Message.CloseDSOK"/> or <see cref="Message.CloseDSReq"/>.
/// </summary>
/// <value>
/// The dialog result.
/// </value>
Message DisableReason { get; }
/// <summary>
/// Try to show the built-in source selector dialog and return the selected source.
/// This is not recommended and is only included for completeness.

View File

@ -23,7 +23,7 @@ namespace NTwain
/// <summary>
/// The build release version number.
/// </summary>
public const string Build = "3.3.9.4"; // change this for each nuget release
public const string Build = "3.3.9.5"; // change this for each nuget release
}

View File

@ -211,6 +211,15 @@ namespace NTwain
/// </value>
public bool StopOnTransferError { get; set; }
/// <summary>
/// Gets the reason a source was disabled (dropped from state 5) if it's due to user action.
/// Mostly only <see cref="Message.CloseDSOK" /> or <see cref="Message.CloseDSReq" />.
/// </summary>
/// <value>
/// The dialog result.
/// </value>
public Message DisableReason { get; private set; }
/// <summary>
/// Opens the data source manager. This must be the first method used
/// before using other TWAIN functions. Calls to this must be followed by

View File

@ -159,6 +159,7 @@ namespace NTwain
ReturnCode ITwainSessionInternal.EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle)
{
_closeRequested = false;
DisableReason = Message.Null;
var rc = ReturnCode.Failure;
_msgLoopHook.Invoke(() =>
@ -306,6 +307,7 @@ namespace NTwain
break;
case Message.CloseDSReq:
case Message.CloseDSOK:
DisableReason = msg;
// even though it says closeDS it's really disable.
// dsok is sent if source is enabled with uionly