mirror of
https://github.com/soukoku/ntwain.git
synced 2025-07-16 01:35:42 +08:00
Added named state enum.
This commit is contained in:
parent
1ae051e933
commit
1ce7c5caf5
@ -156,6 +156,9 @@
|
|||||||
<Compile Include="..\NTwain\SourceEnableMode.cs">
|
<Compile Include="..\NTwain\SourceEnableMode.cs">
|
||||||
<Link>SourceEnableMode.cs</Link>
|
<Link>SourceEnableMode.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="..\NTwain\State.cs">
|
||||||
|
<Link>State.cs</Link>
|
||||||
|
</Compile>
|
||||||
<Compile Include="..\NTwain\TransferErrorEventArgs.cs">
|
<Compile Include="..\NTwain\TransferErrorEventArgs.cs">
|
||||||
<Link>TransferErrorEventArgs.cs</Link>
|
<Link>TransferErrorEventArgs.cs</Link>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
@ -57,6 +57,13 @@ namespace NTwain
|
|||||||
/// <value>The state.</value>
|
/// <value>The state.</value>
|
||||||
int State { get; }
|
int State { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the named state value as defined by the TWAIN spec.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The state.
|
||||||
|
/// </value>
|
||||||
|
State StateEx { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quick flag to check if the DSM has been opened.
|
/// Quick flag to check if the DSM has been opened.
|
||||||
|
@ -88,6 +88,7 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Properties\VersionInfo.cs" />
|
<Compile Include="Properties\VersionInfo.cs" />
|
||||||
<Compile Include="Internals\TentativeStateCommitable.cs" />
|
<Compile Include="Internals\TentativeStateCommitable.cs" />
|
||||||
|
<Compile Include="State.cs" />
|
||||||
<Compile Include="TransferErrorEventArgs.cs" />
|
<Compile Include="TransferErrorEventArgs.cs" />
|
||||||
<Compile Include="TransferReadyEventArgs.cs" />
|
<Compile Include="TransferReadyEventArgs.cs" />
|
||||||
<Compile Include="Triplets\DGControl\DGControl.Callback2.cs" />
|
<Compile Include="Triplets\DGControl\DGControl.Callback2.cs" />
|
||||||
|
43
NTwain/State.cs
Normal file
43
NTwain/State.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace NTwain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The logical state of a TWAIN session.
|
||||||
|
/// </summary>
|
||||||
|
public enum State
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The starting state, corresponds to state 1.
|
||||||
|
/// </summary>
|
||||||
|
DsmUnloaded = 1,
|
||||||
|
/// <summary>
|
||||||
|
/// The DSM library has been loaded, corresponds to state 2.
|
||||||
|
/// </summary>
|
||||||
|
DsmLoaded = 2,
|
||||||
|
/// <summary>
|
||||||
|
/// The DSM has been opened, corresponds to state 3.
|
||||||
|
/// </summary>
|
||||||
|
DsmOpened = 3,
|
||||||
|
/// <summary>
|
||||||
|
/// A data source has been opened, corresponds to state 4.
|
||||||
|
/// </summary>
|
||||||
|
SourceOpened = 4,
|
||||||
|
/// <summary>
|
||||||
|
/// A data source has been enabled, corresponds to state 5.
|
||||||
|
/// </summary>
|
||||||
|
SourceEnabled = 5,
|
||||||
|
/// <summary>
|
||||||
|
/// Data is ready for transfer from the source, corresponds to state 6.
|
||||||
|
/// </summary>
|
||||||
|
TransferReady = 6,
|
||||||
|
/// <summary>
|
||||||
|
/// Data is being transferred, corresponds to state 7.
|
||||||
|
/// </summary>
|
||||||
|
Transferring = 7
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
@ -41,7 +41,10 @@ namespace NTwain
|
|||||||
|
|
||||||
_appId = appId;
|
_appId = appId;
|
||||||
_ownedSources = new Dictionary<string, DataSource>();
|
_ownedSources = new Dictionary<string, DataSource>();
|
||||||
((ITwainSessionInternal)this).ChangeState(1, false);
|
if (PlatformInfo.Current.IsSupported)
|
||||||
|
{
|
||||||
|
((ITwainSessionInternal)this).ChangeState(2, false);
|
||||||
|
}
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
// defaults to false on release since it's only useful during dev
|
// defaults to false on release since it's only useful during dev
|
||||||
EnforceState = true;
|
EnforceState = true;
|
||||||
@ -144,7 +147,7 @@ namespace NTwain
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _state;
|
int _state = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the current state number as defined by the TWAIN spec.
|
/// Gets the current state number as defined by the TWAIN spec.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -165,6 +168,20 @@ namespace NTwain
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the named state value as defined by the TWAIN spec.
|
||||||
|
/// </summary>
|
||||||
|
/// <value>
|
||||||
|
/// The state.
|
||||||
|
/// </value>
|
||||||
|
public State StateEx
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return (State)_state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Quick flag to check if the DSM has been opened.
|
/// Quick flag to check if the DSM has been opened.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user