using EEMSUIClient.Services;
using System.Windows;

namespace EEMSUIClient.Views;

/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
    private readonly ITrayControl _trayController;

    public MainWindow(ITrayControl trayController)
    {
        InitializeComponent();

        _trayController = trayController;
        this.Closing += MainWindow_Closing;
    }

    private void MainWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
    {
        if (!_trayController.IsExiting)
        {
            e.Cancel = true;
            _trayController.HideToTray();
        }
    }
}
