I'm trying to update a large project to latest stable Catel version and need to find a ShowDialog alternative, converting to ShowDialogAsync is simply impossible in our use case.
The project stopped integrating Catel updates with Catel V4.2 and there is a large code base with ~960 synchronous (Main Thread) calls to a method using bool? IUIVisualizerService.ShowDialog(IViewModel) most of which process the returned bool? from ShowDialog and perform conditional handling.
So I need to find an alternative that waits for the window to close without blocking the UIThread and it's currently unfeasible to alter all the calling methods to async, use TaskCommands or move the handling of results to EventHandlers due to lack of manpower and company internal management.
This is the old V4.2 code:
var uiVisualizerService = this.GetDependencyResolver().Resolve<IUIVisualizerService>();
return uiVisualizerService.ShowDialog(viewModelToShow);
The ideal scenario is that there is still a Catel service which works like ShowDialog or alternatively find a different way to show DataWindows synchronously.
Edit:
In case it isn't obvious I can't simply use await due to methods in 500+ classes needing to be rewritten and than manually tested(company policy) or use Task.Wait, Task.Result... etc. due to WPF limitation (if I use blocking call on main thread UI freezes up due to intricacies of the WPF causing it to wait for a chance to runSync on the main thread in order to do the actual displaying of the new window(all UI components actually) which causes an inescapable deadlock), so it definitely can't be solved in any of the conventional ways.
From previous looks at V4.2 of the Catel source I know it just wrapped the old none async method in Task.Run, but it seems to have been dropped and I can't get a public reference to anything like it. – Dhidden1 Apr 02 '19 at 16:20