Added quickie to open a source.

This commit is contained in:
soukoku
2014-05-31 07:13:18 -04:00
parent 91c7e0f83e
commit ac881c0438
3 changed files with 24 additions and 1 deletions

View File

@@ -8,6 +8,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
@@ -332,6 +333,21 @@ namespace NTwain
}
}
/// <summary>
/// Quick shortcut to open a source.
/// </summary>
/// <param name="sourceName">Name of the source.</param>
/// <returns></returns>
public ReturnCode OpenSource(string sourceName)
{
var hit = GetSources().Where(s => string.Equals(s.Name, sourceName)).FirstOrDefault();
if (hit != null)
{
return hit.Open();
}
return ReturnCode.Failure;
}
/// <summary>
/// Gets the manager status. Only call this at state 2 or higher.
/// </summary>