ntwain/NTwain/ITwainState.cs

68 lines
2.0 KiB
C#
Raw Normal View History

2014-04-04 19:25:11 +08:00
using NTwain.Data;
2014-04-06 04:48:28 +08:00
using NTwain.Triplets;
2014-04-04 19:25:11 +08:00
using System;
using System.ComponentModel;
namespace NTwain
{
/// <summary>
/// Interface for keeping track of current TWAIN state with current app and source ids.
/// </summary>
2014-04-06 04:48:28 +08:00
public interface ITwainState : INotifyPropertyChanged
2014-04-06 06:33:21 +08:00
{
2014-04-04 19:25:11 +08:00
/// <summary>
/// Gets the source id used for the session.
/// </summary>
/// <value>The source id.</value>
TWIdentity SourceId { get; }
/// <summary>
/// Gets the current state number as defined by the TWAIN spec.
/// </summary>
/// <value>The state.</value>
int State { get; }
}
2014-04-06 04:48:28 +08:00
2014-04-04 19:25:11 +08:00
/// <summary>
/// Internal interface for state management.
/// </summary>
2014-04-06 04:48:28 +08:00
interface ITwainStateInternal : ITwainState
2014-04-04 19:25:11 +08:00
{
2014-04-06 06:33:21 +08:00
/// <summary>
/// Gets the app id used for the session.
/// </summary>
/// <returns></returns>
TWIdentity GetAppId();
2014-04-04 19:25:11 +08:00
/// <summary>
/// Gets or sets a value indicating whether calls to triplets will verify the current twain session state.
/// </summary>
/// <value>
/// <c>true</c> if state value is enforced; otherwise, <c>false</c>.
/// </value>
bool EnforceState { get; set; }
/// <summary>
/// Changes the state right away.
/// </summary>
/// <param name="newState">The new state.</param>
/// <param name="notifyChange">if set to <c>true</c> to notify change.</param>
void ChangeState(int newState, bool notifyChange);
/// <summary>
/// Gets the pending state changer and tentatively changes the session state to the specified value.
/// Value will only stick if committed.
/// </summary>
/// <param name="newState">The new state.</param>
/// <returns></returns>
ICommitable GetPendingStateChanger(int newState);
2014-04-06 04:48:28 +08:00
void ChangeSourceId(TWIdentity sourceId);
2014-04-04 19:25:11 +08:00
}
interface ICommitable : IDisposable
{
void Commit();
}
}