public Twain(IWindowsMessageHook messageHook) { ScanningComplete += delegate { }; TransferImage += delegate { }; _dataSourceManager = new DataSourceManager(DataSourceManager.DefaultApplicationId, messageHook); _dataSourceManager.ScanningComplete += delegate(object sender, ScanningCompleteEventArgs args) { ScanningComplete(this, args); }; _dataSourceManager.TransferImage += delegate(object sender, TransferImageEventArgs args) { TransferImage(this, args); }; }
public Diagnostics(IWindowsMessageHook messageHook) { using (var dataSourceManager = new DataSourceManager(DataSourceManager.DefaultApplicationId, messageHook)) { dataSourceManager.SelectSource(); var dataSource = dataSourceManager.DataSource; dataSource.OpenSource(); foreach (Capabilities capability in Enum.GetValues(typeof(Capabilities))) { try { var result = Capability.GetBoolCapability(capability, dataSourceManager.ApplicationId, dataSource.SourceId); Console.WriteLine("{0}: {1}", capability, result); } catch (TwainException e) { Console.WriteLine("{0}: {1} {2} {3}", capability, e.Message, e.ReturnCode, e.ConditionCode); } } } }
protected ConditionCode GetStatus() { return(DataSourceManager.GetConditionCode(_applicationId, _sourceId)); }