mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
Camera selection test.
This commit is contained in:
parent
ac881c0438
commit
93779f9232
@ -2056,7 +2056,20 @@ namespace NTwain.Data
|
||||
Constrainable = 0x40,
|
||||
GetHelp = 0x100,
|
||||
GetLabel = 0x200,
|
||||
GetLabelEnum = 0x400
|
||||
GetLabelEnum = 0x400,
|
||||
|
||||
/// <summary>
|
||||
/// Cap applies to entire session/machine.
|
||||
/// </summary>
|
||||
Machine = 0x1000,
|
||||
/// <summary>
|
||||
/// Cap applies to bitonal cameras.
|
||||
/// </summary>
|
||||
Bitonal = 0x2000,
|
||||
/// <summary>
|
||||
/// Cap applies to color cameras.
|
||||
/// </summary>
|
||||
Color = 0x4000
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -15,7 +15,7 @@ namespace NTwain
|
||||
/// <summary>
|
||||
/// Represents a TWAIN data source.
|
||||
/// </summary>
|
||||
public partial class TwainSource : INotifyPropertyChanged
|
||||
public partial class TwainSource
|
||||
{
|
||||
ITwainSessionInternal _session;
|
||||
|
||||
@ -257,5 +257,46 @@ namespace NTwain
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region cameras
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cameras supported by the source.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IList<string> GetCameras()
|
||||
{
|
||||
TWFileSystem fs = new TWFileSystem();
|
||||
List<string> cams = new List<string>();
|
||||
var rc = DGControl.FileSystem.GetFirstFile(fs);
|
||||
while (rc == ReturnCode.Success)
|
||||
{
|
||||
switch (fs.FileType)
|
||||
{
|
||||
case FileType.Camera:
|
||||
case FileType.CameraBottom:
|
||||
case FileType.CameraTop:
|
||||
case FileType.CameraPreview:
|
||||
cams.Add(fs.OutputName);
|
||||
break;
|
||||
}
|
||||
rc = DGControl.FileSystem.GetNextFile(fs);
|
||||
}
|
||||
return cams;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the target camera for cap negotiation that can be set per camera.
|
||||
/// </summary>
|
||||
/// <param name="cameraName"></param>
|
||||
/// <returns></returns>
|
||||
public ReturnCode SetCamera(string cameraName)
|
||||
{
|
||||
TWFileSystem fs = new TWFileSystem();
|
||||
fs.InputName = cameraName;
|
||||
return DGControl.FileSystem.ChangeDirectory(fs);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user