using FSI.Lib.Wpf.ExtensionMethods;
using System.Windows;

namespace FSI.BT.Tools.Commands
{
    /// <summary>
    /// Shows the main window.
    /// </summary>
    public class RadialMenuCommand : CommandBase<RadialMenuCommand>
    {
        public override void Execute(object parameter)
        {
            if (Global.FrmRadialMenu.Visibility == Visibility.Collapsed)
            {
                Global.FrmRadialMenu.ShowCenteredToMouse();
                Global.FrmRadialMenu.ActivateCenteredToMouse();
                return;
            }

            if (Global.FrmRadialMenu.Visibility == Visibility.Hidden)
            {
                Global.FrmRadialMenu.Visibility = Visibility.Visible;
            }
            else
            {
                Global.FrmRadialMenu.Visibility = Visibility.Hidden;
            }

            Global.FrmRadialMenu.ActivateCenteredToMouse();
        }

        public override bool CanExecute(object parameter)
        {
            return Global.AdminRights || Global.UserRights;
        }
    }
}