mirror of
https://github.com/9ParsonsB/Pulsar.git
synced 2025-07-03 09:03:42 -04:00
observatory herald (#30)
* WIP: initial commit for observatory herald * Plugin error handling refactor * make error window non-modal * tidy up plugin error handling * first pass for basic herald functionality * corrections for linux env * Use FNV hash directly instead of managing through dictionary/index file * resolve audio queuing issue, switch to personal NetCoreAudio fork * merge cleanup * add enable setting, populate defaults * framework xml doc update * Adjust settings, add style selection, replace locale with demonym in dropdown list. * Test is position is on screen before saving/loading. * use a default that's actually in the list
This commit is contained in:
@ -15,17 +15,43 @@ namespace Observatory.UI.Views
|
||||
#endif
|
||||
Height = Properties.Core.Default.MainWindowSize.Height;
|
||||
Width = Properties.Core.Default.MainWindowSize.Width;
|
||||
Position = new PixelPoint(Properties.Core.Default.MainWindowPosition.X, Properties.Core.Default.MainWindowPosition.Y);
|
||||
|
||||
var savedPosition = new System.Drawing.Point(Properties.Core.Default.MainWindowPosition.X, Properties.Core.Default.MainWindowPosition.Y);
|
||||
if (PointWithinDesktopWorkingArea(savedPosition))
|
||||
Position = new PixelPoint(Properties.Core.Default.MainWindowPosition.X, Properties.Core.Default.MainWindowPosition.Y);
|
||||
|
||||
Closing += (object sender, System.ComponentModel.CancelEventArgs e) =>
|
||||
{
|
||||
var size = new System.Drawing.Size((int)System.Math.Round(Width), (int)System.Math.Round(Height));
|
||||
var position = new System.Drawing.Point(Position.X, Position.Y);
|
||||
Properties.Core.Default.MainWindowSize = size;
|
||||
Properties.Core.Default.MainWindowPosition = position;
|
||||
|
||||
var position = new System.Drawing.Point(Position.X, Position.Y);
|
||||
if (PointWithinDesktopWorkingArea(position))
|
||||
Properties.Core.Default.MainWindowPosition = position;
|
||||
|
||||
Properties.Core.Default.Save();
|
||||
};
|
||||
}
|
||||
|
||||
private bool PointWithinDesktopWorkingArea(System.Drawing.Point position)
|
||||
{
|
||||
bool inBounds = false;
|
||||
|
||||
foreach (var screen in Screens.All)
|
||||
{
|
||||
if (screen.WorkingArea.TopLeft.X <= position.X
|
||||
&& screen.WorkingArea.TopLeft.Y <= position.Y
|
||||
&& screen.WorkingArea.BottomRight.X > position.X
|
||||
&& screen.WorkingArea.BottomRight.Y > position.Y)
|
||||
{
|
||||
inBounds = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return inBounds;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
Reference in New Issue
Block a user