mirror of
https://github.com/soukoku/ntwain.git
synced 2025-04-05 05:01:57 +08:00
Exposes actual EndXferJob value during transfer ready event. May help #56.
This commit is contained in:
parent
86bf6efe34
commit
870ecd64a4
@ -1,4 +1,5 @@
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using ModernWPF;
|
||||
using ModernWPF.Controls;
|
||||
using ModernWPF.Messages;
|
||||
using NTwain;
|
||||
@ -29,7 +30,7 @@ namespace Sample.WPF
|
||||
if (!DesignerProperties.GetIsInDesignMode(this))
|
||||
{
|
||||
_twainVM = this.DataContext as TwainVM;
|
||||
|
||||
_twainVM.PropertyChanged += _twainVM_PropertyChanged;
|
||||
Messenger.Default.Register<RefreshCommandsMessage>(this, m => m.HandleIt());
|
||||
Messenger.Default.Register<MessageBoxMessage>(this, msg =>
|
||||
{
|
||||
@ -47,6 +48,22 @@ namespace Sample.WPF
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void _twainVM_PropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (e.PropertyName == "State")
|
||||
{
|
||||
if (_twainVM.State == 5)
|
||||
{
|
||||
ModernTheme.ApplyTheme(ModernTheme.Theme.Light, Accent.Orange);
|
||||
}
|
||||
else if (_twainVM.State == 4)
|
||||
{
|
||||
ModernTheme.ApplyTheme(ModernTheme.Theme.Light, Accent.Green);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
e.Cancel = _twainVM.State > 4;
|
||||
|
@ -47,12 +47,12 @@
|
||||
<HintPath>..\..\packages\CommonWin32.2.0.5.6\lib\net35-Client\CommonWin32.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.1.1.35051, Culture=neutral, PublicKeyToken=0e453835af4ee6ce, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.1.1.0\lib\net40\GalaSoft.MvvmLight.dll</HintPath>
|
||||
<Reference Include="GalaSoft.MvvmLight, Version=5.2.0.37223, Culture=neutral, PublicKeyToken=0e453835af4ee6ce, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.2.0.0\lib\net40\GalaSoft.MvvmLight.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.1.1.35049, Culture=neutral, PublicKeyToken=f46ff315b1088208, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.1.1.0\lib\net40\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
<Reference Include="GalaSoft.MvvmLight.Extras, Version=5.2.0.37224, Culture=neutral, PublicKeyToken=f46ff315b1088208, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.2.0.0\lib\net40\GalaSoft.MvvmLight.Extras.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@ -70,11 +70,11 @@
|
||||
<HintPath>..\..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="ModernWPF, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c99d0cfbea7491ef, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\ModernWPF.1.3.4\lib\net40-Client\ModernWPF.dll</HintPath>
|
||||
<HintPath>..\..\packages\ModernWPF.1.3.9\lib\net40-Client\ModernWPF.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="ModernWPF.Mvvm, Version=0.7.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\ModernWPF.Mvvm.0.7.3\lib\net40-Client\ModernWPF.Mvvm.dll</HintPath>
|
||||
<HintPath>..\..\packages\ModernWPF.Mvvm.0.7.5\lib\net40-Client\ModernWPF.Mvvm.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
@ -82,7 +82,7 @@
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Windows.Interactivity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.1.1.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
|
||||
<HintPath>..\..\packages\MvvmLightLibs.5.2.0.0\lib\net40\System.Windows.Interactivity.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
|
@ -9,7 +9,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="GalaSoft.MvvmLight" publicKeyToken="0e453835af4ee6ce" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.1.1.35051" newVersion="5.1.1.35051" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.0.37223" newVersion="5.2.0.37223" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<package id="CommonWin32" version="2.0.5.6" targetFramework="net4-client" />
|
||||
<package id="Microsoft.WindowsAPICodePack-Core" version="1.1.0.2" targetFramework="net4-client" />
|
||||
<package id="Microsoft.WindowsAPICodePack-Shell" version="1.1.0.0" targetFramework="net4-client" />
|
||||
<package id="ModernWPF" version="1.3.4" targetFramework="net4-client" />
|
||||
<package id="ModernWPF.Mvvm" version="0.7.3" targetFramework="net4-client" />
|
||||
<package id="MvvmLightLibs" version="5.1.1.0" targetFramework="net4-client" />
|
||||
<package id="ModernWPF" version="1.3.9" targetFramework="net40-client" />
|
||||
<package id="ModernWPF.Mvvm" version="0.7.5" targetFramework="net4-client" />
|
||||
<package id="MvvmLightLibs" version="5.2.0.0" targetFramework="net4-client" />
|
||||
</packages>
|
@ -2129,7 +2129,7 @@ namespace NTwain.Data
|
||||
/// than None. If this is not 0, the application should expect more data
|
||||
/// from the driver according to CapJobControl settings.
|
||||
/// </summary>
|
||||
public uint EndOfJob { get { return _eOJ; } }
|
||||
public EndXferJob EndOfJob { get { return (EndXferJob)_eOJ; } }
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace NTwain.Internals
|
||||
{
|
||||
#region raise xfer ready
|
||||
|
||||
var preXferArgs = new TransferReadyEventArgs(session.CurrentSource, pending.Count, pending.EndOfJob == 0); ;
|
||||
var preXferArgs = new TransferReadyEventArgs(session.CurrentSource, pending.Count, pending.EndOfJob); ;
|
||||
session.SafeSyncableRaiseEvent(preXferArgs);
|
||||
|
||||
#endregion
|
||||
|
@ -1,6 +1,6 @@
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyCopyright("Copyright \x00a9 Yin-Chun Wang 2012-2015")]
|
||||
[assembly: AssemblyCopyright("Copyright \x00a9 Yin-Chun Wang 2012-2016")]
|
||||
[assembly: AssemblyCompany("Yin-Chun Wang")]
|
||||
|
||||
[assembly: AssemblyVersion(NTwain.VersionInfo.Release)]
|
||||
@ -23,7 +23,7 @@ namespace NTwain
|
||||
/// <summary>
|
||||
/// The build release version number.
|
||||
/// </summary>
|
||||
public const string Build = "3.3.7"; // change this for each nuget release
|
||||
public const string Build = "3.3.8"; // change this for each nuget release
|
||||
|
||||
|
||||
}
|
||||
|
@ -13,12 +13,12 @@ namespace NTwain
|
||||
/// </summary>
|
||||
/// <param name="source">The source.</param>
|
||||
/// <param name="pendingCount">The pending count.</param>
|
||||
/// <param name="endOfJob">if set to <c>true</c> then it's the end of job.</param>
|
||||
public TransferReadyEventArgs(DataSource source, int pendingCount, bool endOfJob)
|
||||
/// <param name="endOfJobFlag"></param>
|
||||
public TransferReadyEventArgs(DataSource source, int pendingCount, EndXferJob endOfJobFlag)
|
||||
{
|
||||
DataSource = source;
|
||||
PendingTransferCount = pendingCount;
|
||||
EndOfJob = endOfJob;
|
||||
EndOfJobFlag = endOfJobFlag;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -46,7 +46,15 @@ namespace NTwain
|
||||
/// Gets a value indicating whether current transfer signifies an end of job in TWAIN world.
|
||||
/// </summary>
|
||||
/// <value><c>true</c> if transfer is end of job; otherwise, <c>false</c>.</value>
|
||||
public bool EndOfJob { get; private set; }
|
||||
public bool EndOfJob { get { return EndOfJobFlag != EndXferJob.None; } }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the end of job flag value for this transfer (if job control is enabled).
|
||||
/// </summary>
|
||||
/// <value>
|
||||
/// The end of job flag.
|
||||
/// </value>
|
||||
public EndXferJob EndOfJobFlag { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the known pending transfer count. This may not be appilicable
|
||||
|
Loading…
Reference in New Issue
Block a user