mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-12-25 18:13:04 +00:00
Avoid using overlay window when not necessary
This commit is contained in:
parent
5ad5679145
commit
f0f84454a8
1 changed files with 38 additions and 31 deletions
|
@ -342,49 +342,56 @@ namespace Ryujinx.Ava.UI.Helpers
|
||||||
isTopDialog = false;
|
isTopDialog = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
parent.Activate();
|
if (parent is MainWindow)
|
||||||
|
|
||||||
_contentDialogOverlayWindow = new ContentDialogOverlayWindow
|
|
||||||
{
|
{
|
||||||
Height = parent.Bounds.Height,
|
parent.Activate();
|
||||||
Width = parent.Bounds.Width,
|
|
||||||
Position = parent.PointToScreen(new Point()),
|
|
||||||
ShowInTaskbar = false,
|
|
||||||
};
|
|
||||||
|
|
||||||
parent.PositionChanged += OverlayOnPositionChanged;
|
_contentDialogOverlayWindow = new ContentDialogOverlayWindow
|
||||||
|
|
||||||
void OverlayOnPositionChanged(object sender, PixelPointEventArgs e)
|
|
||||||
{
|
|
||||||
if (_contentDialogOverlayWindow is null)
|
|
||||||
{
|
{
|
||||||
return;
|
Height = parent.Bounds.Height,
|
||||||
|
Width = parent.Bounds.Width,
|
||||||
|
Position = parent.PointToScreen(new Point()),
|
||||||
|
ShowInTaskbar = false,
|
||||||
|
};
|
||||||
|
|
||||||
|
parent.PositionChanged += OverlayOnPositionChanged;
|
||||||
|
|
||||||
|
void OverlayOnPositionChanged(object sender, PixelPointEventArgs e)
|
||||||
|
{
|
||||||
|
if (_contentDialogOverlayWindow is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
||||||
}
|
}
|
||||||
|
|
||||||
_contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
_contentDialogOverlayWindow.ContentDialog = contentDialog;
|
||||||
}
|
|
||||||
|
|
||||||
_contentDialogOverlayWindow.ContentDialog = contentDialog;
|
bool opened = false;
|
||||||
|
|
||||||
bool opened = false;
|
_contentDialogOverlayWindow.Opened += OverlayOnActivated;
|
||||||
|
|
||||||
_contentDialogOverlayWindow.Opened += OverlayOnActivated;
|
async void OverlayOnActivated(object sender, EventArgs e)
|
||||||
|
|
||||||
async void OverlayOnActivated(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (opened)
|
|
||||||
{
|
{
|
||||||
return;
|
if (opened)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
opened = true;
|
||||||
|
|
||||||
|
_contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
||||||
|
|
||||||
|
result = await ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
opened = true;
|
result = await _contentDialogOverlayWindow.ShowDialog<ContentDialogResult>(parent);
|
||||||
|
}
|
||||||
_contentDialogOverlayWindow.Position = parent.PointToScreen(new Point());
|
else
|
||||||
|
{
|
||||||
result = await ShowDialog();
|
result = await contentDialog.ShowAsync(parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = await _contentDialogOverlayWindow.ShowDialog<ContentDialogResult>(parent);
|
|
||||||
|
|
||||||
async Task<ContentDialogResult> ShowDialog()
|
async Task<ContentDialogResult> ShowDialog()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue