Added source selection methods.

This commit is contained in:
Eugene Wang
2018-11-13 21:02:29 -05:00
parent 63526070f8
commit 485810d46f
11 changed files with 265 additions and 21 deletions

View File

@@ -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)