mirror of
https://github.com/soukoku/ntwain.git
synced 2025-07-17 06:41:24 +08:00
Added transfercanceled event like PR #35.
This commit is contained in:
parent
31b4be0bfe
commit
62c091fd12
10
src/NTwain/TransferCanceledEventArgs.cs
Normal file
10
src/NTwain/TransferCanceledEventArgs.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
using NTwain.Data;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace NTwain
|
||||||
|
{
|
||||||
|
public class TransferCanceledEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -156,6 +156,11 @@ namespace NTwain
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event TwainEventDelegate<TransferReadyEventArgs>? TransferReady;
|
public event TwainEventDelegate<TransferReadyEventArgs>? TransferReady;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Fires when there's a transfer cancellation, e.g. if the user pressed the "Cancel" button.
|
||||||
|
/// </summary>
|
||||||
|
public event TwainEventDelegate<TransferCanceledEventArgs>? TransferCanceled;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when transferred data is available for app to use.
|
/// Fires when transferred data is available for app to use.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -176,6 +176,14 @@ namespace NTwain
|
|||||||
// ok to keep going
|
// ok to keep going
|
||||||
break;
|
break;
|
||||||
case TWRC.CANCEL:
|
case TWRC.CANCEL:
|
||||||
|
// might eventually have option to cancel this or all like transfer ready
|
||||||
|
if (TransferCanceled != null)
|
||||||
|
{
|
||||||
|
_uiThreadMarshaller.Invoke(() =>
|
||||||
|
{
|
||||||
|
TransferCanceled.Invoke(this, new TransferCanceledEventArgs());
|
||||||
|
});
|
||||||
|
};
|
||||||
TW_PENDINGXFERS pending = default;
|
TW_PENDINGXFERS pending = default;
|
||||||
DGControl.PendingXfers.EndXfer(ref _appIdentity, ref _currentDS, ref pending);
|
DGControl.PendingXfers.EndXfer(ref _appIdentity, ref _currentDS, ref pending);
|
||||||
// todo: also reset?
|
// todo: also reset?
|
||||||
|
Loading…
Reference in New Issue
Block a user