- Nice popup UI with proper positioning - Professional README with badges - Remove debug logging - Add .claude/ to .gitignore 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
41 lines
1019 B
C#
41 lines
1019 B
C#
using Hardcodet.Wpf.TaskbarNotification;
|
|
using System.Windows;
|
|
|
|
namespace DellMonitorControl
|
|
{
|
|
public partial class App : Application
|
|
{
|
|
private TaskbarIcon? _trayIcon;
|
|
private MainWindow? _mainWindow;
|
|
|
|
private void Application_Startup(object sender, StartupEventArgs e)
|
|
{
|
|
_trayIcon = (TaskbarIcon)FindResource("TrayIcon");
|
|
_trayIcon.TrayLeftMouseUp += TrayIcon_Click;
|
|
|
|
_mainWindow = new MainWindow();
|
|
}
|
|
|
|
private async void TrayIcon_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
if (_mainWindow == null) return;
|
|
|
|
if (_mainWindow.IsVisible)
|
|
{
|
|
_mainWindow.Hide();
|
|
}
|
|
else
|
|
{
|
|
_mainWindow.ShowNearTray();
|
|
await _mainWindow.LoadMonitors();
|
|
}
|
|
}
|
|
|
|
protected override void OnExit(ExitEventArgs e)
|
|
{
|
|
_trayIcon?.Dispose();
|
|
base.OnExit(e);
|
|
}
|
|
}
|
|
}
|