Add state info to sample window.

This commit is contained in:
Eugene Wang
2023-04-01 19:57:37 -04:00
parent 1417dbbb14
commit a73b128f6b
2 changed files with 60 additions and 14 deletions

View File

@@ -34,9 +34,9 @@ namespace WinForm32
lblDefault.Text = ds.ProductName;
}
private static void Twain_StateChanged(TwainSession session, STATE state)
private void Twain_StateChanged(TwainSession session, STATE state)
{
Debug.WriteLine($"State changed to {state}");
lblState.Text = state.ToString();
}
protected override void OnHandleCreated(EventArgs e)
@@ -83,6 +83,8 @@ namespace WinForm32
{
if (listSources.SelectedItem is TW_IDENTITY_LEGACY ds)
{
twain.TryStepdown(STATE.S3);
twain.DGControl.Identity.OpenDS(ds);
}
}
@@ -91,5 +93,12 @@ namespace WinForm32
{
twain.DGControl.Identity.CloseDS();
}
private void btnOpenDef_Click(object sender, EventArgs e)
{
twain.TryStepdown(STATE.S3);
twain.DGControl.Identity.OpenDS(twain.DefaultSource);
}
}
}