Added open/close to test form.

This commit is contained in:
Eugene Wang
2023-04-01 19:38:04 -04:00
parent a779ee6b0e
commit 1417dbbb14
3 changed files with 123 additions and 22 deletions

View File

@@ -92,10 +92,21 @@ namespace NTwain
/// <returns>The final state.</returns>
public STATE TryStepdown(STATE targetState)
{
if (State > targetState)
int tries = 0;
while (State > targetState)
{
// shouldn't care about handle when closing really
DGControl.Parent.CloseDSM(ref _hwnd);
if (tries++ > 5) break;
switch (State)
{
case STATE.S4:
DGControl.Identity.CloseDS();
break;
case STATE.S3:
// shouldn't care about handle when closing really
DGControl.Parent.CloseDSM(ref _hwnd);
break;
}
}
return State;
}