Added memory mgmt entry.

This commit is contained in:
Eugene Wang
2018-11-13 20:04:05 -05:00
parent 4d3690874d
commit 63526070f8
13 changed files with 126 additions and 39 deletions

View File

@@ -8,18 +8,33 @@ namespace NetCoreConsole
{
static void Main(string[] args)
{
var config = new TwainConfigurationBuilder()
.DefineApp(Assembly.GetExecutingAssembly())
.Build();
using (var session = new TwainSession(config))
try
{
session.PropertyChanged += Session_PropertyChanged;
var config = new TwainConfigBuilder()
.DefineApp(Assembly.GetExecutingAssembly())
.Build();
Console.WriteLine($"App = {(config.Is64Bit ? "64bit" : "32bit")}");
Console.WriteLine($"Platform = {config.Platform}");
var handle = IntPtr.Zero;
session.Open(ref handle);
using (var session = new TwainSession(config))
{
session.PropertyChanged += Session_PropertyChanged;
var handle = IntPtr.Zero;
if (session.Open(ref handle) == NTwain.Data.ReturnCode.Success)
{
}
}
Console.WriteLine("Test ended, press Enter to exit...");
Console.ReadLine();
}
catch (Exception ex)
{
Console.WriteLine("ERROR: " + ex.ToString());
}
}
private static void Session_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
@@ -27,7 +42,7 @@ namespace NetCoreConsole
var session = (TwainSession)sender;
if (e.PropertyName == "State")
{
Console.WriteLine($"State changed to {session.State}");
Console.WriteLine($"Session state changed to {session.State}");
}
}
}