fix: Added parent window for modal dialog
This commit is contained in:
@@ -68,7 +68,9 @@ namespace ClashN.Handler
|
|||||||
FilterIndex = 2,
|
FilterIndex = 2,
|
||||||
RestoreDirectory = true
|
RestoreDirectory = true
|
||||||
};
|
};
|
||||||
if (fileDialog.ShowDialog() != DialogResult.OK)
|
|
||||||
|
IWin32Window parent = App.Current.MainWindow.WpfWindow2WinFormWin32Window();
|
||||||
|
if (fileDialog.ShowDialog(parent) != DialogResult.OK)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ using ZXing.Windows.Compatibility;
|
|||||||
|
|
||||||
namespace ClashN
|
namespace ClashN
|
||||||
{
|
{
|
||||||
class Utils
|
static class Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 资源Json操作
|
#region 资源Json操作
|
||||||
@@ -1274,5 +1274,21 @@ namespace ClashN
|
|||||||
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public static System.Windows.Forms.IWin32Window WpfWindow2WinFormWin32Window(this System.Windows.Window wpfWindow)
|
||||||
|
{
|
||||||
|
return new WinFormWin32WindowWrapper(
|
||||||
|
new System.Windows.Interop.WindowInteropHelper(wpfWindow).Handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class WinFormWin32WindowWrapper : System.Windows.Forms.IWin32Window
|
||||||
|
{
|
||||||
|
public WinFormWin32WindowWrapper(IntPtr hwnd)
|
||||||
|
{
|
||||||
|
Handle = hwnd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IntPtr Handle { get; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,7 +117,9 @@ namespace ClashN.ViewModels
|
|||||||
Multiselect = false,
|
Multiselect = false,
|
||||||
Filter = "YAML|*.yaml;*.yml|All|*.*"
|
Filter = "YAML|*.yaml;*.yml|All|*.*"
|
||||||
};
|
};
|
||||||
if (fileDialog.ShowDialog() != DialogResult.OK)
|
|
||||||
|
IWin32Window parent = App.Current.MainWindow.WpfWindow2WinFormWin32Window();
|
||||||
|
if (fileDialog.ShowDialog(parent) != DialogResult.OK)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,13 @@ namespace ClashN.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((new PorfileEditWindow(item)).ShowDialog() == true)
|
|
||||||
|
PorfileEditWindow dialog = new PorfileEditWindow(item)
|
||||||
|
{
|
||||||
|
Owner = App.Current.MainWindow,
|
||||||
|
};
|
||||||
|
|
||||||
|
if (dialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
RefreshProfiles();
|
RefreshProfiles();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -125,7 +125,12 @@ namespace ClashN.ViewModels
|
|||||||
}, this.IsValid());
|
}, this.IsValid());
|
||||||
SetGlobalHotkeyCmd = ReactiveCommand.Create(() =>
|
SetGlobalHotkeyCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
new GlobalHotkeySettingWindow().ShowDialog();
|
GlobalHotkeySettingWindow dialog = new GlobalHotkeySettingWindow()
|
||||||
|
{
|
||||||
|
Owner = App.Current.MainWindow
|
||||||
|
};
|
||||||
|
|
||||||
|
dialog.ShowDialog();
|
||||||
}, this.IsValid());
|
}, this.IsValid());
|
||||||
|
|
||||||
//System proxy
|
//System proxy
|
||||||
|
|||||||
Reference in New Issue
Block a user