mirror of
https://github.com/soukoku/ntwain.git
synced 2026-02-25 13:04:07 +08:00
Added error handling to wpf example.
This commit is contained in:
@@ -10,6 +10,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using CommonWin32;
|
||||
using System.Threading;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
|
||||
namespace Tester.WPF
|
||||
{
|
||||
@@ -42,6 +43,29 @@ namespace Tester.WPF
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnTransferError(TransferErrorEventArgs e)
|
||||
{
|
||||
if (e.Exception != null)
|
||||
{
|
||||
Messenger.Default.Send(new DialogMessage(e.Exception.Message, null)
|
||||
{
|
||||
Caption = "Transfer Error Exception",
|
||||
Icon = System.Windows.MessageBoxImage.Error,
|
||||
Button = System.Windows.MessageBoxButton.OK
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Messenger.Default.Send(new DialogMessage(string.Format("Return Code: {0}\nCondition Code: {1}", e.ReturnCode, e.SourceStatus.ConditionCode), null)
|
||||
{
|
||||
Caption = "Transfer Error",
|
||||
Icon = System.Windows.MessageBoxImage.Error,
|
||||
Button = System.Windows.MessageBoxButton.OK
|
||||
});
|
||||
}
|
||||
base.OnTransferError(e);
|
||||
}
|
||||
|
||||
protected override void OnTransferReady(TransferReadyEventArgs e)
|
||||
{
|
||||
// set it up to use file xfer
|
||||
|
||||
Reference in New Issue
Block a user