mirror of
https://github.com/ckaczor/FloatingStatusWindow.git
synced 2026-01-14 01:25:36 -05:00
Expose extra windows properties
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using Point = System.Windows.Point;
|
||||
using Size = System.Windows.Size;
|
||||
|
||||
namespace FloatingStatusWindowLibrary
|
||||
{
|
||||
public class FloatingStatusWindow : IDisposable
|
||||
{
|
||||
public event EventHandler WindowResized = delegate { };
|
||||
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly TaskbarIcon _taskbarIcon;
|
||||
|
||||
@@ -75,10 +79,16 @@ namespace FloatingStatusWindowLibrary
|
||||
|
||||
_mainWindow = new MainWindow(windowSource);
|
||||
_mainWindow.Closed += HandleMainWindowClosed;
|
||||
_mainWindow.SizeChanged += HandleWindowSizeChanged;
|
||||
|
||||
_mainWindow.Show();
|
||||
}
|
||||
|
||||
void HandleWindowSizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
WindowResized(this, new EventArgs());
|
||||
}
|
||||
|
||||
void HandleChangeAppearancemMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
var appearanceWindow = new AppearanceWindow(_mainWindow.WindowSettings);
|
||||
@@ -130,5 +140,25 @@ namespace FloatingStatusWindowLibrary
|
||||
|
||||
_mainWindow.Close();
|
||||
}
|
||||
|
||||
public Point Location
|
||||
{
|
||||
get { return new Point(_mainWindow.Left, _mainWindow.Top); }
|
||||
}
|
||||
|
||||
public Size Size
|
||||
{
|
||||
get { return new Size(_mainWindow.Width, _mainWindow.Height); }
|
||||
}
|
||||
|
||||
public Size ContentSize
|
||||
{
|
||||
get { return new Size(_mainWindow.HtmlLabel.ActualWidth, _mainWindow.HtmlLabel.ActualHeight); }
|
||||
}
|
||||
|
||||
public WindowSettings Settings
|
||||
{
|
||||
get { return _mainWindow.WindowSettings; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user