diff --git a/src/Carnac.Logic/Models/PopupSettings.cs b/src/Carnac.Logic/Models/PopupSettings.cs index b2be6486..dffada47 100644 --- a/src/Carnac.Logic/Models/PopupSettings.cs +++ b/src/Carnac.Logic/Models/PopupSettings.cs @@ -53,6 +53,25 @@ protected void OnLeftChanged(EventArgs e) if (handler != null) handler(this, e); } + double top; + public double Top + { + get { return top; } + set + { + top = value; + OnTopChanged(EventArgs.Empty); + } + } + + public event EventHandler TopChanged; + + protected void OnTopChanged(EventArgs e) + { + var handler = TopChanged; + if (handler != null) handler(this, e); + } + [NotifyProperty(AlsoNotifyFor = new[] { "Margins" })] public int TopOffset { get; set; } diff --git a/src/Carnac.Logic/ScreenManager.cs b/src/Carnac.Logic/ScreenManager.cs index e9378f18..2c1ae28f 100644 --- a/src/Carnac.Logic/ScreenManager.cs +++ b/src/Carnac.Logic/ScreenManager.cs @@ -70,7 +70,6 @@ public IEnumerable GetScreens() { s.RelativeWidth = 200 * (s.Width / maxWidth); s.RelativeHeight = s.RelativeWidth * (s.Height / s.Width); - s.Top *= (s.RelativeHeight / s.Height); } } diff --git a/src/Carnac/CarnacTrayIcon.cs b/src/Carnac/CarnacTrayIcon.cs index cf776940..84859ca2 100644 --- a/src/Carnac/CarnacTrayIcon.cs +++ b/src/Carnac/CarnacTrayIcon.cs @@ -8,7 +8,7 @@ namespace Carnac { - public class CarnacTrayIcon : IDisposable + public sealed class CarnacTrayIcon : IDisposable { readonly NotifyIcon trayIcon; diff --git a/src/Carnac/UI/KeyShowView.xaml.cs b/src/Carnac/UI/KeyShowView.xaml.cs index 72abbdf7..ea3d34a2 100644 --- a/src/Carnac/UI/KeyShowView.xaml.cs +++ b/src/Carnac/UI/KeyShowView.xaml.cs @@ -36,6 +36,8 @@ protected override void OnSourceInitialized(EventArgs e) var vm = ((KeyShowViewModel)DataContext); Left = vm.Settings.Left; vm.Settings.LeftChanged += SettingsLeftChanged; + Top = vm.Settings.Top; + vm.Settings.TopChanged += SettingsTopChanged; WindowState = WindowState.Maximized; } @@ -92,5 +94,13 @@ void SettingsLeftChanged(object sender, EventArgs e) Left = vm.Settings.Left; WindowState = WindowState.Maximized; } + + void SettingsTopChanged(object sender, EventArgs e) + { + WindowState = WindowState.Normal; + var vm = ((KeyShowViewModel)DataContext); + Top = vm.Settings.Top; + WindowState = WindowState.Maximized; + } } } diff --git a/src/Carnac/UI/PreferencesViewModel.cs b/src/Carnac/UI/PreferencesViewModel.cs index 7eb14b5d..bcfc95e0 100644 --- a/src/Carnac/UI/PreferencesViewModel.cs +++ b/src/Carnac/UI/PreferencesViewModel.cs @@ -172,6 +172,7 @@ void PlaceScreen() } Settings.Left = SelectedScreen.Left; + Settings.Top = SelectedScreen.Top; } } } \ No newline at end of file