DynAreaWeight.xaml.cs 3.29 KB
Newer Older
1 2 3 4
using FLY.OBJComponents.Client;
using FLY.OBJComponents.Common;
using FLY.OBJComponents.IService;
using FLY.Thick.Base.UI;
5
using FLY.Thick.Base.UI.UiModule;
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
using FLY.Weight2.Client;
using FLY.Weight2.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.Weight2.UI.Client.UiModule
{
    /// <summary>
    /// DynAreaWeight.xaml 的交互逻辑
    /// </summary>
    public partial class DynAreaWeight : UserControl
    {

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

        IUnityContainer container;
        IWeightSystemService weightSystemService;
34
        DynAreaErrorVm2 errorVm;
35 36 37 38 39 40 41 42 43 44 45 46

        SetPLCUpdatePlan setPlan;

        public DynAreaWeight()
        {
            InitializeComponent();

        }

        [InjectionMethod]
        public void Init(
            IUnityContainer container,
47 48
            IWeightSystemService weightSystemService,
            [Dependency("weighterWarningService")] IWarningSystem2Service warningSystem
49 50 51 52 53 54 55
            )
        {
            this.container = container;
            this.weightSystemService = weightSystemService;

            grid_weighter.DataContext = this.weightSystemService;

56 57 58 59 60
            errorVm = new DynAreaErrorVm2();
            errorVm.Init(container, warningSystem, "称重");
            grid_error.DataContext = errorVm;


61
            //注册属性更新计划
潘栩锋's avatar
潘栩锋 committed
62
            string objname = nameof(IWeightSystemService.Accessory);
63 64
            setPlan = new SetPLCUpdatePlan(
                this.weightSystemService.PLCos,
潘栩锋's avatar
潘栩锋 committed
65
                objname,
66
                new string[] {
潘栩锋's avatar
潘栩锋 committed
67 68 69
                    nameof(IWeightSystemService.Accessory.Thickness),
                    nameof(IWeightSystemService.Accessory.RimCharge)
                });
70 71 72 73 74 75 76 77
        }
    }
    public class UiModule2_DynAreaWeight : MultiLayout.UiModule.IUiModule2
    {
        /// <summary>
        /// 控件标题
        /// 它的值取决于culture
        /// </summary>
78
        public string Title=> "单组称重.状态";
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115

        public ComponentType Type => ComponentType.DynArea;
        public bool IsUnique => true;
        /// <summary>
        /// 控件
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FrameworkElement GetComponent(int id, IUnityContainer container)
        {
            DynAreaWeight graph = new DynAreaWeight();
            container.BuildUp(graph);
            return graph;
        }

        /// <summary>
        /// 控件缩略图,用于编辑界面时,大致看看
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public FrameworkElement GetThumbnail()
        {
            return new System.Windows.Controls.Grid();
        }


        /// <summary>
        /// 给出全部控件ID, 控件自行删除没有的参数
        /// </summary>
        /// <param name="IDs"></param>
        public void MatchParam(int[] IDs)
        {
        }
    }
}