(WPF c# application) . I have mainwindow UI thread where I use a dispatcher invoke in many places of the code. From main thread I start another thread. I try to abort the thread immediately by clicking a cancel button. On cancel button click I use Thread.abort() to terminate the thread. But thread does not abort. I observed that dispatcher invoke is waiting and UI is not responding. I want to run the thread synchronously and not use begininvoke..?
button cancel event is in class A ,we are calling thread abort.
Threadx.abort();
when thread abort is called we are calling custom message box from the thread via delegate
custom message box calling looks like this and is in class A
this.Dispatcher.Invoke((Action)(() =>
{
QMessageBox = new QatMessageBox(this);
result = QMessageBox.Show(messageBoxTest, messageBoxCaption, messageBoxButton, messageBoxImage);
}));
custom message box looks like this and is in a separate class
public QatMessageBox(Window owner)
{
InitializeComponent();
Owner = owner;
this.DataContext = this;
}