Cancelling dialog from another thread


We need to close a dialog requested with UserInput.Request from another thread or inside the requested data object. For example, dialog will be popped, and when an interrupt is triggered from an instrument dialog must be closed without pressing any of the submit buttons.

Is there a way to achieve this?

Hi @btyilmaz,

There are a couple of ways, the best is probably to use a kind of fake thread (TapThread Context) which you can abort. The user input will stop when the “TapThread” is aborted, but you need a new "thread"as you dont want to abort your main thread :

            var myUserInputRequest = new MyUserInputObject();
            TapThread threadContext = null;
            TapThread.WithNewContext(() =>
                threadContext = TapThread.Current;
                    // catch the error occuring when the thread aborts.

            // on some other thread or callback This will cause the user input to be aborted.
1 Like