void ShowDialog(string mess, string title, Exception ex, bool forceClose = false) { if (Application.Current?.Dispatcher?.CheckAccess() == false) { Application.Current.Dispatcher.Invoke ( new Func <string, string, Exception, bool, bool> ( (m, c, mbb, mbi) => { ShowDialog(m, c, mbb, mbi); return(true); } ), mess, title, ex, forceClose ); return; } _dialogFactory.GetDialogView <IErrorDialog>().Show(mess, title, ex, forceClose); }