Changeset 2 for swappable message loop hook implementations.

This commit is contained in:
soukoku
2014-05-25 08:45:52 -04:00
parent 61b0e89313
commit 764c75a7a0
12 changed files with 285 additions and 63 deletions

View File

@@ -65,7 +65,11 @@ namespace Tester.WPF
{
base.OnSourceInitialized(e);
var rc = _twainVM.Open();
// use this for internal msg loop
//var rc = _twainVM.Open();
// use this to hook into current app loop
var rc = _twainVM.Open(new WpfMessageLoopHook(new WindowInteropHelper(this).Handle));
if (rc == ReturnCode.Success)
{
SrcList.ItemsSource = _twainVM.GetSources().Select(s => new DSVM { DS = s });

View File

@@ -3,17 +3,17 @@ using System.Windows.Forms;
namespace Tester.Winform
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestForm());
}
}
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TestForm());
}
}
}

View File

@@ -239,7 +239,10 @@ namespace Tester.Winform
}
if (_twain.State < 3)
{
// use this for internal msg loop
_twain.Open();
// use this to hook into current app loop
//_twain.Open(new WinformMessageLoopHook(this.Handle));
}
if (_twain.State >= 3)