diff --git a/NTwain.Net35/NTwain.Net35.csproj b/NTwain.Net35/NTwain.Net35.csproj
index efa01ff..9ebbb92 100644
--- a/NTwain.Net35/NTwain.Net35.csproj
+++ b/NTwain.Net35/NTwain.Net35.csproj
@@ -156,6 +156,9 @@
SourceEnableMode.cs
+
+ State.cs
+
TransferErrorEventArgs.cs
diff --git a/NTwain/ITwainSession.cs b/NTwain/ITwainSession.cs
index 4d922f4..cdaf2a3 100644
--- a/NTwain/ITwainSession.cs
+++ b/NTwain/ITwainSession.cs
@@ -57,6 +57,13 @@ namespace NTwain
/// The state.
int State { get; }
+ ///
+ /// Gets the named state value as defined by the TWAIN spec.
+ ///
+ ///
+ /// The state.
+ ///
+ State StateEx { get; }
///
/// Quick flag to check if the DSM has been opened.
diff --git a/NTwain/NTwain.csproj b/NTwain/NTwain.csproj
index 2dc6d56..6a1fd8f 100644
--- a/NTwain/NTwain.csproj
+++ b/NTwain/NTwain.csproj
@@ -88,6 +88,7 @@
+
diff --git a/NTwain/State.cs b/NTwain/State.cs
new file mode 100644
index 0000000..a37483c
--- /dev/null
+++ b/NTwain/State.cs
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace NTwain
+{
+ ///
+ /// The logical state of a TWAIN session.
+ ///
+ public enum State
+ {
+ ///
+ /// The starting state, corresponds to state 1.
+ ///
+ DsmUnloaded = 1,
+ ///
+ /// The DSM library has been loaded, corresponds to state 2.
+ ///
+ DsmLoaded = 2,
+ ///
+ /// The DSM has been opened, corresponds to state 3.
+ ///
+ DsmOpened = 3,
+ ///
+ /// A data source has been opened, corresponds to state 4.
+ ///
+ SourceOpened = 4,
+ ///
+ /// A data source has been enabled, corresponds to state 5.
+ ///
+ SourceEnabled = 5,
+ ///
+ /// Data is ready for transfer from the source, corresponds to state 6.
+ ///
+ TransferReady = 6,
+ ///
+ /// Data is being transferred, corresponds to state 7.
+ ///
+ Transferring = 7
+ };
+
+}
diff --git a/NTwain/TwainSession.cs b/NTwain/TwainSession.cs
index a22bba4..0d92a4b 100644
--- a/NTwain/TwainSession.cs
+++ b/NTwain/TwainSession.cs
@@ -41,7 +41,10 @@ namespace NTwain
_appId = appId;
_ownedSources = new Dictionary();
- ((ITwainSessionInternal)this).ChangeState(1, false);
+ if (PlatformInfo.Current.IsSupported)
+ {
+ ((ITwainSessionInternal)this).ChangeState(2, false);
+ }
#if DEBUG
// defaults to false on release since it's only useful during dev
EnforceState = true;
@@ -144,7 +147,7 @@ namespace NTwain
return null;
}
- int _state;
+ int _state = 1;
///
/// Gets the current state number as defined by the TWAIN spec.
///
@@ -165,6 +168,20 @@ namespace NTwain
}
}
+ ///
+ /// Gets the named state value as defined by the TWAIN spec.
+ ///
+ ///
+ /// The state.
+ ///
+ public State StateEx
+ {
+ get
+ {
+ return (State)_state;
+ }
+ }
+
///
/// Quick flag to check if the DSM has been opened.
///