More modernization

- Split generic "common" libraries into specific libraries
- Use other packages in lieu of custom code
- General cleanup
This commit is contained in:
2023-04-05 16:06:38 -04:00
parent f480a6c373
commit b5f570688d
46 changed files with 1210 additions and 656 deletions

View File

@@ -1,11 +1,11 @@
using FeedCenter.Properties;
using DebounceThrottle;
using FeedCenter.Properties;
using System;
using System.ComponentModel;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;
using System.Windows.Media;
using Common.Helpers;
namespace FeedCenter
{
@@ -90,25 +90,22 @@ namespace FeedCenter
SaveWindowSettings();
// Save settings
_database.SaveChanges(() => Settings.Default.Save());
_database.SaveChanges(Settings.Default.Save);
// Get rid of the notification icon
NotificationIcon.Dispose();
}
private DelayedMethod _windowStateDelay;
private readonly DebounceDispatcher _updateWindowSettingsDispatcher = new(500);
private void HandleWindowSizeChanged(object sender, SizeChangedEventArgs e)
{
_windowStateDelay ??= new DelayedMethod(500, UpdateWindowSettings);
_windowStateDelay.Reset();
_updateWindowSettingsDispatcher.Debounce(() => Dispatcher.Invoke(UpdateWindowSettings));
}
private void HandleWindowLocationChanged(object sender, EventArgs e)
{
_windowStateDelay ??= new DelayedMethod(500, UpdateWindowSettings);
_windowStateDelay.Reset();
_updateWindowSettingsDispatcher.Debounce(() => Dispatcher.Invoke(UpdateWindowSettings));
}
private void UpdateBorder()
@@ -152,6 +149,7 @@ namespace FeedCenter
}
private bool _activated;
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
@@ -172,4 +170,4 @@ namespace FeedCenter
Settings.Default.PropertyChanged += HandlePropertyChanged;
}
}
}
}