Calling source.Enable(SourceEnableMode.ShowUI, true, this.Handle) from a "server"

Issue #108 new
Carlo created an issue

I have a problem with the method Enable of class DataSource when called as written in the title.

The situation is the following, I have an Http server running on port 9092 and I create a Windows form as an event fired after an Http request. In the form I have a button I would like to use to scan using the source UI. To do so I associated the Click event with the following method

private void btnAllSettings_Click(object sender, EventArgs e)
{
    _twain.CurrentSource.Enable(SourceEnableMode.ShowUI, true, this.Handle);
}

where _twain is a TwainSession.

During the program excution, when I click the button, the program gets stuck and no debug is possible because when the debug reach the following code

_dispatcher.Invoke(DispatcherPriority.Normal, new Action(() =>
{
    try
    {
        action();
    }
    catch (Exception ex) { error = ex; }
}));

in InternalMessageLoopHook class, I can't go deeper and the debug gets stuck.

The same situation happens when I try to use a different thread to generate the new form, even if I do not use the Http server.

If I do not use the server and I do not use multithreading the source UI appears normally.

Comments (0)

  1. Log in to comment