UcThickness.xaml.cs 3.87 KB
Newer Older
1
using FLY.OBJComponents.Client;
2 3
using FLY.Weight.IService;
using MultiLayout.UiModule;
4 5 6 7 8 9 10 11 12 13 14 15 16 17
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
18
using Unity;
19

20
namespace FLY.Weight.UI.Client.UiModule
21 22 23 24 25 26 27
{
    /// <summary>
    /// UcThickness.xaml 的交互逻辑
    /// </summary>
    public partial class UcThickness : UserControl
    {

28
        IWeightSystemService weightSystemService;
29 30 31 32 33 34 35

        SetPLCUpdatePlan setPlan_accessory;

        public UcThickness()
        {
            InitializeComponent();
        }
36
        public void Init(IWeightSystemService weightSystemService)
37
        {
38 39
            this.weightSystemService = weightSystemService;
            this.DataContext = this.weightSystemService;
40 41

            setPlan_accessory = new SetPLCUpdatePlan(
42 43
                this.weightSystemService.PLCos,
                this.weightSystemService.Accessory,
44 45 46 47 48 49 50 51 52 53 54 55 56 57
                new string[] {
                        "TotalFilmWidth",
                        "IsRimNoRecycle",
                        "RimWidth",
                        "ActFilmWidth",
                        "SetThickness",
                        "TargetVelocity",
                        "CurrentVelocity"
                });
        }


        private void button_thickness_Click(object sender, RoutedEventArgs e)
        {
58 59
            WdThickness w = new WdThickness();
            if (weightSystemService.Items.Count() < 1)
60 61
                return;

62 63 64 65
            w.SetThickness = (int)weightSystemService.Accessory.SetThickness;
            w.FilmWidth = (int)weightSystemService.Accessory.TotalFilmWidth;
            w.RimWidth = (int)weightSystemService.Accessory.RimWidth;
            w.IsRimNoRecycle = weightSystemService.Accessory.IsRimNoRecycle;
66 67 68 69 70 71 72



            w.Owner = FLY.ControlLibrary.COMMON.GetWindow(this);

            if (w.ShowDialog() == true)
            {
73 74 75 76
                weightSystemService.Accessory.SetThickness = w.SetThickness;
                weightSystemService.Accessory.TotalFilmWidth = w.FilmWidth;
                weightSystemService.Accessory.RimWidth = w.RimWidth;
                weightSystemService.Accessory.IsRimNoRecycle = w.IsRimNoRecycle;
77 78 79 80 81 82

                FLY.ControlLibrary.Window_Tip.Show("", "厚度参数设置成功", TimeSpan.FromSeconds(2));
            }
        }

    }
83
    public class UiModule2_UcThickness : IUiModule2
84 85 86 87 88
    {
        /// <summary>
        /// 控件标题
        /// 它的值取决于culture
        /// </summary>
89 90 91 92 93
        public string Title => "称重厚度";

        public ComponentType Type => ComponentType.Graph;

        public bool IsUnique => true;
94 95 96 97 98 99 100

        /// <summary>
        /// 控件
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
101
        public FrameworkElement GetComponent(int id, IUnityContainer container)
102 103
        {
            UcThickness graph = new UcThickness();
104
            container.BuildUp(graph);
105 106 107 108 109 110 111 112 113
            return graph;
        }

        /// <summary>
        /// 控件缩略图,用于编辑界面时,大致看看
        /// 创建时,需要给它唯一ID,让加载自己的数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
114
        public FrameworkElement GetThumbnail()
115 116 117 118 119 120 121 122 123 124 125 126 127 128
        {
            return new System.Windows.Controls.Grid();
        }


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