public void ResetDeviceEventCapability(
TwainCapability deviceCap
)
deviceCap
Contains the capability values to reset
This method will reset CAP_DEVICEEVENT capability to defaults values. To get CAP_DEVICEEVENT capability values, call GetDeviceEventCapability method, and to set the CAP_DEVICEEVENT values, call SetDeviceEventCapability method.
using Leadtools;
using Leadtools.Twain;
public void GetDeviceEventCapabilityExample(IntPtr parent)
{
TwainSession session = new TwainSession();
session.Startup(parent, "manufacturer", "productFamily", "version", "application", TwainStartupFlags.None);
try
{
TwainCapability twnCap = session.GetDeviceEventCapability();
if (twnCap.Information.Type == TwainCapabilityType.DeviceEvent)
{
int count = twnCap.ArrayCapability.Count;
for (int i = 0; i < count; i++)
{
TwainCapabilityValue capValue = (TwainCapabilityValue)twnCap.ArrayCapability.GetValue(i);
switch (capValue)
{
case TwainCapabilityValue.DeviceEventCheckBattery:
MessageBox.Show("Device event checks the battery");
break;
case TwainCapabilityValue.DeviceEventCheckResolution:
MessageBox.Show("Device event checks the resolution");
break;
case TwainCapabilityValue.DeviceEventDeviceReady:
MessageBox.Show("Device event is ready");
break;
}
}
TwainCapability cap = new TwainCapability();
cap.Information.Type = TwainCapabilityType.DeviceEvent;
cap.Information.ContainerType = TwainContainerType.Array;
cap.ArrayCapability.Count = 5;
cap.ArrayCapability.ItemType = TwainItemType.Uint16;
cap.ArrayCapability.SetValue(0, TwainCapabilityValue.DeviceEventDeviceReady);
cap.ArrayCapability.SetValue(1, TwainCapabilityValue.DeviceEventCheckDeviceOnline);
cap.ArrayCapability.SetValue(2, TwainCapabilityValue.DeviceEventCheckBattery);
cap.ArrayCapability.SetValue(3, TwainCapabilityValue.DeviceEventCheckPowerSupply);
cap.ArrayCapability.SetValue(4, TwainCapabilityValue.DeviceEventCheckResolution);
session.SetDeviceEventCapability(cap);
MessageBox.Show("DeviceEvent is changed successfully");
session.ResetDeviceEventCapability(twnCap);
MessageBox.Show("DeviceEvent is reset to default values successfully");
}
}
catch
{ }
session.Shutdown();
}