diff --git a/src/NTwain/ITwainSession.cs b/src/NTwain/ITwainSession.cs index 7547ba7..a1ec498 100644 --- a/src/NTwain/ITwainSession.cs +++ b/src/NTwain/ITwainSession.cs @@ -94,6 +94,15 @@ namespace NTwain /// bool StopOnTransferError { get; set; } + /// + /// Gets the reason a source was disabled (dropped from state 5) if it's due to user action. + /// Mostly only or . + /// + /// + /// The dialog result. + /// + Message DisableReason { get; } + /// /// Try to show the built-in source selector dialog and return the selected source. /// This is not recommended and is only included for completeness. diff --git a/src/NTwain/Properties/VersionInfo.cs b/src/NTwain/Properties/VersionInfo.cs index 00a600c..6cc7015 100644 --- a/src/NTwain/Properties/VersionInfo.cs +++ b/src/NTwain/Properties/VersionInfo.cs @@ -23,7 +23,7 @@ namespace NTwain /// /// The build release version number. /// - 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 } diff --git a/src/NTwain/TwainSession.cs b/src/NTwain/TwainSession.cs index ff70e4d..cbae876 100644 --- a/src/NTwain/TwainSession.cs +++ b/src/NTwain/TwainSession.cs @@ -211,6 +211,15 @@ namespace NTwain /// public bool StopOnTransferError { get; set; } + /// + /// Gets the reason a source was disabled (dropped from state 5) if it's due to user action. + /// Mostly only or . + /// + /// + /// The dialog result. + /// + public Message DisableReason { get; private set; } + /// /// Opens the data source manager. This must be the first method used /// before using other TWAIN functions. Calls to this must be followed by diff --git a/src/NTwain/TwainSessionInternal.cs b/src/NTwain/TwainSessionInternal.cs index 91d98fa..3113108 100644 --- a/src/NTwain/TwainSessionInternal.cs +++ b/src/NTwain/TwainSessionInternal.cs @@ -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