using Hardcodet.Wpf.TaskbarNotification;

namespace EEMSCenterUI.Helper;

internal class WindowHelper
{
    private static bool _isShow = true;
    public static bool ShowWindow()
    {
        Application.Current.MainWindow.Show();
        _isShow = true;
        return true;
    }

    public static void AutoHideShow()
    {
        _ = _isShow switch
        {
            true => HideWindow(),
            false => ShowWindow(),
        };
    }


    public static bool HideWindow()
    {
        App.ShowBalloonTip("EEMS Server", "服务正在后台运行...", BalloonIcon.Info);
        Application.Current.MainWindow.Hide();
        _isShow = false;
        return true;
    }

    public static bool ExitWindow()
    {
        MessageBoxResult result = MessageBox.Show(Application.Current.MainWindow, "确认退出 EEMS 服务？", "退出提示", MessageBoxButton.YesNo, MessageBoxImage.Question);

        switch (result)
        {
            case MessageBoxResult.Yes:
                App.Current.Shutdown();
                break;
            case MessageBoxResult.None:
            case MessageBoxResult.OK:
            case MessageBoxResult.Cancel:
            case MessageBoxResult.No:
            default:
                break;
        }
        return true;
    }

}
