DynAreaWeightV5.xaml.cs 1.87 KB
using FLY.OBJComponents.Client;
using FLY.OBJComponents.Common;
using FLY.OBJComponents.IService;
using FLY.Thick.Base.UI;
using FLY.Thick.Base.UI.UiModule;
using FLY.Weight.Client;
using FLY.Weight.IService;
using FObjBase;
using MultiLayout;
using MultiLayout.UiModule;
using System;
using System.ComponentModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using System.Windows.Threading;
using Unity;

namespace FLY.Weight.UI.Client.UiModule
{
    /// <summary>
    /// DynAreaWeight.xaml 的交互逻辑
    /// </summary>
    public partial class DynAreaWeightV5 : UserControl
    {

        #region 延时推送 MARKNO
        const int MARKNO_UPDATEERROR = 1;
        #endregion

        IUnityContainer container;
        IWeightSystemService weightSystemService;
        SetPLCUpdatePlan setPlan;
        DynAreaErrorVm2 errorVm;

        public DynAreaWeightV5()
        {
            InitializeComponent();

        }

        [InjectionMethod]
        public void Init(
            IUnityContainer container,

            IWeightSystemService weightSystemService,
            [Dependency("weighterWarningService")] IWarningSystem2Service warningSystem
            )
        {
            this.container = container;
            this.weightSystemService = weightSystemService;

            grid_weighter.DataContext = this.weightSystemService;

            errorVm = new DynAreaErrorVm2();
            errorVm.Init(container, warningSystem, "称重");
            grid_error.DataContext = errorVm;

            //注册属性更新计划
            string objname = nameof(IWeightSystemService.Accessory);
            setPlan = new SetPLCUpdatePlan(
                this.weightSystemService.PLCos,
                objname,
                new string[] {
                    nameof(Common.WeighterAccessory.Thickness)});

       }
    }

}