mirror of
https://github.com/soukoku/ntwain.git
synced 2025-11-08 02:24:46 +08:00
Hid some more triplets.
This commit is contained in:
@@ -96,5 +96,12 @@ namespace NTwain
|
||||
/// <param name="session">The session.</param>
|
||||
/// <returns></returns>
|
||||
TWStatus GetStatus();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the manager status. Only call this at state 3 or higher.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <returns></returns>
|
||||
TWStatusUtf8 GetStatusUtf8();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,10 +6,10 @@ namespace NTwain.Triplets
|
||||
/// <summary>
|
||||
/// Represents <see cref="DataArgumentType.DeviceEvent"/>.
|
||||
/// </summary>
|
||||
public sealed class DeviceEvent : OpBase
|
||||
sealed class DeviceEvent : OpBase
|
||||
{
|
||||
internal DeviceEvent(ITwainSessionInternal session) : base(session) { }
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "0#")]
|
||||
|
||||
public ReturnCode Get(out TWDeviceEvent sourceDeviceEvent)
|
||||
{
|
||||
Session.VerifyState(4, 7, DataGroups.Control, DataArgumentType.DeviceEvent, Message.Get);
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace NTwain.Triplets
|
||||
/// <summary>
|
||||
/// Represents <see cref="DataArgumentType.StatusUtf8"/>.
|
||||
/// </summary>
|
||||
public sealed class StatusUtf8 : OpBase
|
||||
sealed class StatusUtf8 : OpBase
|
||||
{
|
||||
internal StatusUtf8(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
@@ -16,8 +16,9 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
/// <param name="status">The status.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetManager(TWStatusUtf8 status)
|
||||
public ReturnCode GetManager(out TWStatusUtf8 status)
|
||||
{
|
||||
status = new TWStatusUtf8();
|
||||
Session.VerifyState(3, 7, DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get);
|
||||
return Dsm.DsmEntry(Session.AppId, null, Message.Get, status);
|
||||
}
|
||||
@@ -28,8 +29,9 @@ namespace NTwain.Triplets
|
||||
/// </summary>
|
||||
/// <param name="status">The status.</param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode GetSource(TWStatusUtf8 status)
|
||||
public ReturnCode GetSource(out TWStatusUtf8 status)
|
||||
{
|
||||
status = new TWStatusUtf8();
|
||||
Session.VerifyState(3, 7, DataGroups.Control, DataArgumentType.StatusUtf8, Message.Get);
|
||||
return Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, Message.Get, status);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace NTwain.Triplets
|
||||
}
|
||||
}
|
||||
DeviceEvent _deviceEvent;
|
||||
public DeviceEvent DeviceEvent
|
||||
internal DeviceEvent DeviceEvent
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -163,7 +163,7 @@ namespace NTwain.Triplets
|
||||
}
|
||||
}
|
||||
StatusUtf8 _statusUtf8;
|
||||
public StatusUtf8 StatusUtf8
|
||||
internal StatusUtf8 StatusUtf8
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -6,11 +6,10 @@ namespace NTwain.Triplets
|
||||
/// <summary>
|
||||
/// Represents <see cref="DataArgumentType.ImageInfo"/>.
|
||||
/// </summary>
|
||||
public sealed class ImageInfo : OpBase
|
||||
sealed class ImageInfo : OpBase
|
||||
{
|
||||
internal ImageInfo(ITwainSessionInternal session) : base(session) { }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1021:AvoidOutParameters", MessageId = "0#")]
|
||||
public ReturnCode Get(out TWImageInfo info)
|
||||
{
|
||||
Session.VerifyState(6, 7, DataGroups.Image, DataArgumentType.ImageInfo, Message.Get);
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace NTwain.Triplets
|
||||
}
|
||||
|
||||
ImageInfo _imgInfo;
|
||||
public ImageInfo ImageInfo
|
||||
internal ImageInfo ImageInfo
|
||||
{
|
||||
get
|
||||
{
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace NTwain
|
||||
TWIdentity id;
|
||||
if (DGControl.Identity.GetDefault(out id) == ReturnCode.Success)
|
||||
{
|
||||
return new TwainSource(this, id);
|
||||
return TwainSource.GetInstance(this, id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ namespace NTwain
|
||||
TWIdentity id;
|
||||
if (DGControl.Identity.UserSelect(out id) == ReturnCode.Success)
|
||||
{
|
||||
return new TwainSource(this, id);
|
||||
return TwainSource.GetInstance(this, id);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -311,7 +311,7 @@ namespace NTwain
|
||||
var rc = DGControl.Identity.GetFirst(out srcId);
|
||||
while (rc == ReturnCode.Success)
|
||||
{
|
||||
yield return new TwainSource(this, srcId);
|
||||
yield return TwainSource.GetInstance(this, srcId);
|
||||
rc = DGControl.Identity.GetNext(out srcId);
|
||||
}
|
||||
}
|
||||
@@ -327,6 +327,18 @@ namespace NTwain
|
||||
return stat;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the manager status. Only call this at state 3 or higher.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <returns></returns>
|
||||
public TWStatusUtf8 GetStatusUtf8()
|
||||
{
|
||||
TWStatusUtf8 stat;
|
||||
DGControl.StatusUtf8.GetManager(out stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -16,9 +16,21 @@ namespace NTwain
|
||||
/// </summary>
|
||||
public partial class TwainSource : INotifyPropertyChanged
|
||||
{
|
||||
static readonly Dictionary<string, TwainSource> __globalInstances = new Dictionary<string, TwainSource>();
|
||||
|
||||
internal static TwainSource GetInstance(ITwainSessionInternal session, TWIdentity sourceId)
|
||||
{
|
||||
var key = string.Format("{0}|{1}", sourceId.Manufacturer, sourceId.ProductFamily, sourceId.ProductName);
|
||||
if (__globalInstances.ContainsKey(key))
|
||||
{
|
||||
return __globalInstances[key];
|
||||
}
|
||||
return __globalInstances[key] = new TwainSource(session, sourceId);
|
||||
}
|
||||
|
||||
ITwainSessionInternal _session;
|
||||
|
||||
internal TwainSource(ITwainSessionInternal session, TWIdentity sourceId)
|
||||
private TwainSource(ITwainSessionInternal session, TWIdentity sourceId)
|
||||
{
|
||||
_session = session;
|
||||
Identity = sourceId;
|
||||
@@ -84,6 +96,18 @@ namespace NTwain
|
||||
_session.DGControl.Status.GetSource(out stat);
|
||||
return stat;
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the source status. Only call this at state 4 or higher.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <returns></returns>
|
||||
public TWStatusUtf8 GetStatusUtf8()
|
||||
{
|
||||
TWStatusUtf8 stat;
|
||||
_session.DGControl.StatusUtf8.GetSource(out stat);
|
||||
return stat;
|
||||
}
|
||||
|
||||
|
||||
#region properties
|
||||
|
||||
|
||||
Reference in New Issue
Block a user