mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 20:59:23 +08:00
Small logic change.
This commit is contained in:
parent
4a29263c5c
commit
b784f584bb
@ -576,9 +576,10 @@ namespace NTwain
|
||||
|
||||
TWEvent evt = new TWEvent();
|
||||
evt.pEvent = msgPtr;
|
||||
handled = DGControl.Event.ProcessEvent(evt) == ReturnCode.DSEvent;
|
||||
|
||||
HandleSourceMsg(evt.TWMessage);
|
||||
if (handled = DGControl.Event.ProcessEvent(evt) == ReturnCode.DSEvent)
|
||||
{
|
||||
HandleSourceMsg(evt.TWMessage);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
@ -604,7 +605,7 @@ namespace NTwain
|
||||
var ctx = o as SynchronizationContext;
|
||||
if (ctx != null)
|
||||
{
|
||||
_syncer.Send(blah =>
|
||||
_syncer.Post(blah =>
|
||||
{
|
||||
HandleSourceMsg(msg);
|
||||
}, null);
|
||||
@ -623,10 +624,7 @@ namespace NTwain
|
||||
// method that handles msg from the source, whether it's from wndproc or callbacks
|
||||
void HandleSourceMsg(Message msg)
|
||||
{
|
||||
if (msg != Message.Null)
|
||||
{
|
||||
Debug.WriteLine(string.Format("Thread {0}: HandleSourceMsg at state {1} with MSG={2}.", Thread.CurrentThread.ManagedThreadId, State, msg));
|
||||
}
|
||||
Debug.WriteLine(string.Format("Thread {0}: HandleSourceMsg at state {1} with MSG={2}.", Thread.CurrentThread.ManagedThreadId, State, msg));
|
||||
|
||||
switch (msg)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ using System.Windows.Interop;
|
||||
using System.Runtime.InteropServices;
|
||||
using CommonWin32;
|
||||
using System.Threading;
|
||||
using ModernWPF.Controls;
|
||||
|
||||
namespace Tester.WPF
|
||||
{
|
||||
@ -79,7 +80,7 @@ namespace Tester.WPF
|
||||
var rc2 = twain.CloseSource();
|
||||
rc2 = twain.CloseManager();
|
||||
|
||||
MessageBox.Show("Success!");
|
||||
ModernMessageBox.Show(this, "Success!");
|
||||
};
|
||||
twain.TransferReady += (s, te) =>
|
||||
{
|
||||
@ -92,7 +93,7 @@ namespace Tester.WPF
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
//te.OutputFile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "test.bmp");
|
||||
//te.OutputFile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "test.bmp");
|
||||
//}
|
||||
};
|
||||
}
|
||||
@ -157,7 +158,7 @@ namespace Tester.WPF
|
||||
twain.DGControl.Status.GetManager(out status);
|
||||
}
|
||||
|
||||
MessageBox.Show(string.Format("Step {0}: RC={1}, CC={2}", step, rc, status.ConditionCode));
|
||||
ModernMessageBox.Show(this, string.Format("Step {0}: RC={1}, CC={2}", step, rc, status.ConditionCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user