-
-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShowMessageBox
freeze primary window when show a message box on secondary windows
#374
Comments
ShowDialog
freeze primary window when show a message box on secondary windowsShowMessageBox
freeze primary window when show a message box on secondary windows
var window = new InputWindow
{
Title = "title",
Prompt = "Hi, test native owner window",
Response = "",
Result = Results.Cancel,
ShowInTaskbar = false,
};
window.Owner = this;
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowDialog(); this above will open a modal dialog to freeze both two window. So using the native func Then I noted That's the reason why @canton7 can we make |
I have find a workaround for this ticket. I will make a PR for this latter. var mbvm = new MessageBoxViewModel();
mbvm.Setup("Hi, test stylet message box");
if (IoC.Get<IViewManager>().CreateAndBindViewForModelIfNecessary(mbvm) is Window window)
{
window.Owner = this;
window.Loaded += (o, args) =>
{
var dlgWindow = o as Window;
// dlg don't have a Owner
if(dlgWindow?.Owner == null)
return;
var windows = Application.Current.Windows;
// enable the window != Owner
foreach (Window w in windows)
{
if (w == dlgWindow.Owner) continue;
if (w is { IsLoaded: true })
{
if (HwndSource.FromVisual(w) is HwndSource hwndSource)
EnableWindow(hwndSource.Handle, true);
}
}
};
window.WindowStartupLocation = WindowStartupLocation.CenterOwner;
window.ShowDialog();
} |
- make a workaround to fix `ShowMessageBox from tab window will freeze primary window`, see canton7/Stylet#374
- make a workaround to fix `ShowMessageBox from tab window will freeze primary window`, see canton7/Stylet#374
Description
When call
IoC.Get<IWindowManager>().ShowDialog
orIoC.Get<IWindowManager>().ShowMessageBox
on secondary window, the primary window will be freezen.With ShowDialog provide by the runtime, primary window works fine.
To Reproduce
Code to reproduce the bug, which someone else can run.
Version Info
Additional Info
With stylet messagebox:
With system messagebox:
Here is the code related:
https://github.com/1Remote/PRemoteM/blob/dev_net6/Ui/View/Host/TabWindowViewModel.cs#L236-L237
https://github.com/1Remote/PRemoteM/blob/58805bd0bb59757e9016a89cdfd14300a64278b7/Ui/Utils/MessageBoxHelper.cs#L26-L33
And you can get the exe file from:
https://github.com/1Remote/PRemoteM/releases
The text was updated successfully, but these errors were encountered: