using MainShell.Hardware;
using MainShell.ToolBox.View;
using MaxwellFramework.Core.Interfaces;
using MwFramework.Controls.UIControl.ViewModel;
using MwFramework.Device;
using MwFramework.ManagerService;
using Stylet;
using StyletIoC;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace MainShell.ToolBox.ViewModel
{
    [Inject(Key = "Footer")]
    public class FootViewModel : Screen, IView
    {
        private bool _isEnabled = true;

        public bool IsEnabled
        {
            get { return _isEnabled; }
            set { SetAndNotify(ref _isEnabled, value); }  
        }
        private ManualMotionWindow _manualMotionWindow;
        private ToolBoxWindowView _toolBoxWindow;
        private readonly HardwareManager _hardwareManager;
        public FootViewModel(HardwareManager hardwareManager)
        {
            _hardwareManager = hardwareManager;
            _manualMotionWindow = new ManualMotionWindow();

            _manualMotionWindow.DataContext = new ManualControlViewModel(new List<MwCard>
            {
                _hardwareManager.TdCard,_hardwareManager.AcsCard
            })
            {
                IsShowVelAxis = false
            };
            _manualMotionWindow.Owner = Application.Current.MainWindow;

        }


        public void ToolBoxClick()
        {
            _toolBoxWindow = _toolBoxWindow ?? new ToolBoxWindowView();
            _toolBoxWindow.WindowState = System.Windows.WindowState.Normal;
            _toolBoxWindow.Show();
            _toolBoxWindow.Activate();
        }

        public void ManualMotionOperateClick()
        {
            _manualMotionWindow.Show();
            _manualMotionWindow.Activate();
        }
    }
}
