2 Commits
v3.7.3 ... v2

Author SHA1 Message Date
soukoku
b9a5bb86ad Small-time backports. 2014-09-16 18:42:28 -04:00
Eugene Wang
35cbad1056 Merged in master (pull request #5)
Sync from master
2014-09-15 06:47:17 -04:00
7 changed files with 63 additions and 23 deletions

View File

@@ -949,7 +949,7 @@ namespace NTwain.Data
} }
break; break;
case ContainerType.Range: case ContainerType.Range:
for (var i = read.RangeMinValue; i <= read.RangeMaxValue; i += read.RangeStepSize) for (var i = read.RangeMinValue; i >= read.RangeMinValue && i <= read.RangeMaxValue; i += read.RangeStepSize)
{ {
toPopulate.Add(i); toPopulate.Add(i);
} }
@@ -1390,7 +1390,10 @@ namespace NTwain.Data
/// </summary> /// </summary>
public sealed partial class TWExtImageInfo : IDisposable public sealed partial class TWExtImageInfo : IDisposable
{ {
internal TWExtImageInfo() /// <summary>
/// Initializes a new instance of the <see cref="TWExtImageInfo"/> class.
/// </summary>
public TWExtImageInfo()
{ {
_info = new TWInfo[200]; _info = new TWInfo[200];
} }

View File

@@ -12,7 +12,7 @@ namespace NTwain
/// <summary> /// <summary>
/// General interface for a TWAIN session. /// General interface for a TWAIN session.
/// </summary> /// </summary>
public interface ITwainSession : INotifyPropertyChanged public interface ITwainSession : IEnumerable<TwainSource>, INotifyPropertyChanged
{ {
/// <summary> /// <summary>

View File

@@ -41,8 +41,6 @@ namespace NTwain.Internals
ReturnCode EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle); ReturnCode EnableSource(SourceEnableMode mode, bool modal, IntPtr windowHandle);
SynchronizationContext SynchronizationContext { get; set; }
/// <summary> /// <summary>
/// Gets the triplet operations defined for audio data group. /// Gets the triplet operations defined for audio data group.
/// </summary> /// </summary>

View File

@@ -14,6 +14,6 @@ namespace NTwain
// keep this same in majors releases // keep this same in majors releases
public const string Release = "2.0.0.0"; public const string Release = "2.0.0.0";
// change this for each nuget release // change this for each nuget release
public const string Build = "2.0.7"; public const string Build = "2.0.8";
} }
} }

View File

@@ -18,7 +18,7 @@ namespace NTwain
/// <summary> /// <summary>
/// Basic class for interfacing with TWAIN. You should only have one of this per application process. /// Basic class for interfacing with TWAIN. You should only have one of this per application process.
/// </summary> /// </summary>
public partial class TwainSession public partial class TwainSession
{ {
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="TwainSession"/> class. /// Initializes a new instance of the <see cref="TwainSession"/> class.
@@ -71,7 +71,7 @@ namespace NTwain
} }
return source; return source;
} }
#region ITwainSession Members #region ITwainSession Members
@@ -267,13 +267,7 @@ namespace NTwain
/// <returns></returns> /// <returns></returns>
public IEnumerable<TwainSource> GetSources() public IEnumerable<TwainSource> GetSources()
{ {
TWIdentity srcId; return this;
var rc = ((ITwainSessionInternal)this).DGControl.Identity.GetFirst(out srcId);
while (rc == ReturnCode.Success)
{
yield return GetSourceInstance(this, srcId);
rc = ((ITwainSessionInternal)this).DGControl.Identity.GetNext(out srcId);
}
} }
/// <summary> /// <summary>
@@ -427,7 +421,10 @@ namespace NTwain
var hand = PropertyChanged; var hand = PropertyChanged;
if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); } if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine("PropertyChanged event error: " + ex.ToString());
}
} }
else else
{ {
@@ -438,13 +435,44 @@ namespace NTwain
var hand = PropertyChanged; var hand = PropertyChanged;
if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); } if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine("PropertyChanged event error: " + ex.ToString());
}
}, null); }, null);
} }
} }
#endregion #endregion
#region IEnumerable<TwainSource> Members
/// <summary>
/// Gets the enumerator.
/// </summary>
/// <returns></returns>
public IEnumerator<TwainSource> GetEnumerator()
{
TWIdentity srcId;
var rc = ((ITwainSessionInternal)this).DGControl.Identity.GetFirst(out srcId);
while (rc == ReturnCode.Success)
{
yield return GetSourceInstance(this, srcId);
rc = ((ITwainSessionInternal)this).DGControl.Identity.GetNext(out srcId);
}
}
#endregion
#region IEnumerable Members
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
#endregion
#region events overridables #region events overridables
/// <summary> /// <summary>
@@ -463,7 +491,10 @@ namespace NTwain
onEventFunc(); onEventFunc();
if (handler != null) { handler(this, EventArgs.Empty); } if (handler != null) { handler(this, EventArgs.Empty); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine(handler.Method.Name + " event error: " + ex.ToString());
}
} }
else else
{ {
@@ -474,7 +505,10 @@ namespace NTwain
onEventFunc(); onEventFunc();
if (handler != null) { handler(this, EventArgs.Empty); } if (handler != null) { handler(this, EventArgs.Empty); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine(handler.Method.Name + " event error: " + ex.ToString());
}
}, null); }, null);
} }
} }
@@ -499,7 +533,10 @@ namespace NTwain
onEventFunc(e); onEventFunc(e);
if (handler != null) { handler(this, e); } if (handler != null) { handler(this, e); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine(handler.Method.Name + " event error: " + ex.ToString());
}
} }
else else
{ {
@@ -512,7 +549,10 @@ namespace NTwain
onEventFunc(e); onEventFunc(e);
if (handler != null) { handler(this, e); } if (handler != null) { handler(this, e); }
} }
catch { } catch (Exception ex)
{
Debug.WriteLine(handler.Method.Name + " event error: " + ex.ToString());
}
}, null); }, null);
} }
} }

View File

@@ -305,6 +305,5 @@ namespace NTwain
} }
#endregion #endregion
} }
} }

View File

@@ -60,7 +60,7 @@ and call Open() to start using it.
#!c# #!c#
// choose and open the first source found // choose and open the first source found
IEnumerable<TwainSources> sources = session.GetSources(); IEnumerable<TwainSource> sources = session.GetSources();
var myDS = sources.First(); var myDS = sources.First();
myDS.Open(); myDS.Open();