using FLY.DownBlowing.IService;
using FLY.OBJComponents.Client;
using System.Windows;
using Unity;

namespace FLY.DownBlowing.UI.Client.UiModule
{
    /// <summary>
    /// Window_Frequency.xaml 的交互逻辑
    /// </summary>
    public partial class WdManual : FLY.ControlLibrary.WindowBigClose
    {
        IDownBlowingSystemService downBlowingSystem;
        SetPLCUpdatePlan setPlan_winder;
        public WdManual()
        {
            InitializeComponent();
        }

        [InjectionMethod]
        public void Init(
            IDownBlowingSystemService downBlowingSystem)
        {
            this.downBlowingSystem = downBlowingSystem;
            this.DataContext = downBlowingSystem;

            //IsTongAuto
            //注册属性更新计划
            string objname = nameof(IDownBlowingSystemService.WinderData);
            setPlan_winder = new SetPLCUpdatePlan(
                this.downBlowingSystem.PLCos,
                objname,
                new string[] {
                    nameof(this.downBlowingSystem.WinderData.IsOwTongAuto),
                    nameof(this.downBlowingSystem.WinderData.OwCalenderRollerAct),
                    nameof(this.downBlowingSystem.WinderData.OwTurnoverInching),
                    nameof(this.downBlowingSystem.WinderData.OwCuttingFilm),
                    nameof(this.downBlowingSystem.WinderData.OwTurnoverOrg),
                    nameof(this.downBlowingSystem.WinderData.OwPressureArmOffset),
                    nameof(this.downBlowingSystem.WinderData.OwPushRod),
                    nameof(this.downBlowingSystem.WinderData.OwTongLoosen),
                    nameof(this.downBlowingSystem.WinderData.OwTongUp),
                    nameof(this.downBlowingSystem.WinderData.OwTongDown),
                    nameof(this.downBlowingSystem.WinderData.OwTongIn),
                    nameof(this.downBlowingSystem.WinderData.OwTongOut) 
                });

        }

        private void WindowBigClose_Unloaded(object sender, RoutedEventArgs e)
        {
            if (setPlan_winder != null)
            {
                setPlan_winder.Dispose();
                setPlan_winder = null;
            }
        }
    }


}