using FLY.Thick.Base.IService;
using MultiLayout.UiModule;
using System.Windows;
using System.Windows.Controls;
using Unity;

namespace FLY.Thick.Base.UI.UiModule
{
    /// <summary>
    /// MenuMotion.xaml 的交互逻辑
    /// </summary>
    public partial class MenuMotion : UserControl
    {
        ITDGageService gageService;
        public MenuMotion()
        {
            InitializeComponent();
        }
        [InjectionMethod]
        public void Init(ITDGageService gageService)
        {
            this.gageService = gageService;
            this.DataContext = gageService;
            //gageService.DynArea.ControllerState
        }
        private void btnBackwClick(object sender, RoutedEventArgs e)
        {
            gageService.StartP2(Base.Common.STARTP2_MODE.BACKW);

        }

        private void btnForwClick(object sender, RoutedEventArgs e)
        {
            gageService.StartP2(Base.Common.STARTP2_MODE.FORW);
        }

        private void btnOrgClick(object sender, RoutedEventArgs e)
        {
            gageService.StartP2(Base.Common.STARTP2_MODE.ORG);
        }

        private void btnStopClick(object sender, RoutedEventArgs e)
        {
            gageService.StartP2(Base.Common.STARTP2_MODE.STOP);
        }

        private void btnScanClick(object sender, RoutedEventArgs e)
        {
            gageService.StartP1();
        }
    }

    public class UiModule2_MenuMotion : IUiModule2
    {
        public string Title => "测厚.扫描运行";

        public ComponentType Type => ComponentType.Menu;

        public bool IsUnique => true;

        public FrameworkElement GetComponent(int id, IUnityContainer container)
        {
            MenuMotion menu = new MenuMotion();
            container.BuildUp(menu);
            return menu;
        }

        public FrameworkElement GetThumbnail()
        {
            return new System.Windows.Controls.Grid();
        }

        public void MatchParam(int[] IDs)
        {

        }
    }
}
