private void UnsuccessImportAction(string errorMessage) { //Shows MessageBoxWindow in UIThread (used for calling methods from threads) Avalonia.Threading.Dispatcher.UIThread.InvokeAsync(() => { MessageBoxWindow msgbox = MessageBoxWindow.CreateMessageBox("Error", errorMessage); msgbox.ShowDialog(this); //ShowDialog - used for blocking gui }); }