mirror of
https://github.com/soukoku/ntwain.git
synced 2026-01-26 21:48:36 +08:00
Added source selection methods.
This commit is contained in:
@@ -15,6 +15,7 @@ namespace NetCoreConsole
|
||||
.Build();
|
||||
Console.WriteLine($"App = {(config.Is64Bit ? "64bit" : "32bit")}");
|
||||
Console.WriteLine($"Platform = {config.Platform}");
|
||||
Console.WriteLine();
|
||||
|
||||
using (var session = new TwainSession(config))
|
||||
{
|
||||
@@ -23,18 +24,33 @@ namespace NetCoreConsole
|
||||
var handle = IntPtr.Zero;
|
||||
if (session.Open(ref handle) == NTwain.Data.ReturnCode.Success)
|
||||
{
|
||||
Console.WriteLine("Available data sources:");
|
||||
foreach (var src in session.GetSources())
|
||||
{
|
||||
Console.WriteLine($"\t{src}");
|
||||
}
|
||||
Console.WriteLine();
|
||||
|
||||
var defaultSrc = session.DefaultSource;
|
||||
Console.WriteLine($"Default data source = {defaultSrc}");
|
||||
Console.WriteLine();
|
||||
|
||||
var selectSrc = session.ShowSourceSelector();
|
||||
Console.WriteLine($"Selected data source = {selectSrc}");
|
||||
Console.WriteLine();
|
||||
|
||||
//session.DefaultSource = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Console.WriteLine("Test ended, press Enter to exit...");
|
||||
Console.ReadLine();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("ERROR: " + ex.ToString());
|
||||
}
|
||||
|
||||
Console.WriteLine("Test ended, press Enter to exit...");
|
||||
Console.ReadLine();
|
||||
}
|
||||
|
||||
private static void Session_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user