Fix MessageBox crash when UI has no Screens (#708)
This commit is contained in:
parent
893d68190d
commit
ff3ac2d6fd
@ -177,9 +177,12 @@ Libation.
|
|||||||
tbx.MinWidth = vm.TextBlockMinWidth;
|
tbx.MinWidth = vm.TextBlockMinWidth;
|
||||||
tbx.Text = message;
|
tbx.Text = message;
|
||||||
|
|
||||||
var thisScreen = owner.Screens.ScreenFromVisual(owner);
|
|
||||||
|
|
||||||
var maxSize = new Size(0.20 * thisScreen.Bounds.Width, 0.9 * thisScreen.Bounds.Height - 55);
|
var thisScreen = owner.Screens?.ScreenFromVisual(owner);
|
||||||
|
|
||||||
|
var maxSize
|
||||||
|
= thisScreen is null ? owner.ClientSize
|
||||||
|
: new Size(0.20 * thisScreen.Bounds.Width, 0.9 * thisScreen.Bounds.Height - 55);
|
||||||
|
|
||||||
var desiredMax = new Size(maxSize.Width, maxSize.Height);
|
var desiredMax = new Size(maxSize.Width, maxSize.Height);
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace LibationAvalonia.Views
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Configure_Upgrade();
|
Configure_Upgrade();
|
||||||
|
|
||||||
Loaded += MainWindow_Loaded;
|
Opened += MainWindow_Opened;
|
||||||
Closing += MainWindow_Closing;
|
Closing += MainWindow_Closing;
|
||||||
LibraryLoaded += MainWindow_LibraryLoaded;
|
LibraryLoaded += MainWindow_LibraryLoaded;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ namespace LibationAvalonia.Views
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MainWindow_Loaded(object sender, EventArgs e)
|
private async void MainWindow_Opened(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (Configuration.Instance.FirstLaunch)
|
if (Configuration.Instance.FirstLaunch)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user