mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Camera selection test.
This commit is contained in:
@@ -2056,7 +2056,20 @@ namespace NTwain.Data
|
|||||||
Constrainable = 0x40,
|
Constrainable = 0x40,
|
||||||
GetHelp = 0x100,
|
GetHelp = 0x100,
|
||||||
GetLabel = 0x200,
|
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>
|
/// <summary>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace NTwain
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a TWAIN data source.
|
/// Represents a TWAIN data source.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TwainSource : INotifyPropertyChanged
|
public partial class TwainSource
|
||||||
{
|
{
|
||||||
ITwainSessionInternal _session;
|
ITwainSessionInternal _session;
|
||||||
|
|
||||||
@@ -257,5 +257,46 @@ namespace NTwain
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user