schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
using DataEntity.Share;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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.Shapes;
using XHandler.Class;
using XHandler.View.Consumables;
using XHandler.View.ManualCoating;
using XImagingXhandler.XDAL;
 
namespace XHandler.View.ManualPick
{
    public class DataFillInfo
    {
        public int column { get; set; }
        public string columnName { get; set; }
        public string columnContent { get; set; }
        public int nFrom { get; set; }
        public int nTo { get; set; }
        public List<int> rows { get; set; }
        public DataFillInfo()
        {
            nFrom = 1;
            nTo = 1;
            rows = new List<int>();
        }
    }
 
    /// <summary>
    /// DataFillItems.xaml 的交互逻辑
    /// </summary>
    public partial class DataFillItems : Window
    {
        #region custom event
        public event EventHandler closeEvent;
 
        /// <summary>
        /// 确定
        /// </summary>
        public static readonly RoutedEvent OKRoutedEvent =
            EventManager.RegisterRoutedEvent("OKEvent", RoutingStrategy.Bubble, typeof(CustomEvent.CustomRoutedEventHandler<DataFillInfo>), typeof(DataFillTips));
 
        [Description("OKEvent")]
        public event CustomEvent.CustomRoutedEventHandler<DataFillInfo> OKEvent
        {
            add
            {
                this.AddHandler(OKRoutedEvent, value);
            }
            remove
            {
                this.RemoveHandler(OKRoutedEvent, value);
            }
        }
 
        private void RaiseOKEvent(DataFillInfo info)
        {
            CustomRoutedEventArgs<DataFillInfo> arg = new CustomRoutedEventArgs<DataFillInfo>(OKRoutedEvent, info);
            this.RaiseEvent(arg);
        }
        #endregion
 
        public DataFillInfo dataFillInfo { get; set; }
        public CutSetting cutSetting = null;
 
        public DataFillItems(DataFillInfo info)
        {
            InitializeComponent();
            dataFillInfo = info;
            texblockName.Text = dataFillInfo.columnName;
            textBoxName.Text = dataFillInfo.columnContent;
            if (dataFillInfo.rows.Count > 0)
            {
                textBoxNoFrom.Text = dataFillInfo.nFrom.ToString();
                textBoxNoTo.Text = dataFillInfo.nTo.ToString();
            }
            this.Owner = (Window)Shared.Main;
        }
 
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (EventResponseController.Instance.CanExecute() == false)
                return;
 
            closeEvent?.Invoke(this, EventArgs.Empty);
            this.Close();
        }
 
        private void btnOk_Click(object sender, RoutedEventArgs e)
        {
            if (EventResponseController.Instance.CanExecute() == false)
                return;
            dataFillInfo.columnContent = textBoxName.Text.Trim();
            int nForm = 1, nTo = 1;
 
            int.TryParse(textBoxNoFrom.Text.Trim(), out nForm);
            int.TryParse(textBoxNoTo.Text.Trim(), out nTo);
 
            dataFillInfo.nFrom = nForm;
            dataFillInfo.nTo = nTo;
 
            //RaiseOKEvent(dataFillInfo);
            if (cutSetting != null)
            {
                cutSetting.DataFillTips_OKEvent();
                this.Close();
            }
        }
 
        #region 拖动窗体
        /// <summary>
        /// 拖动窗体
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton == MouseButton.Left)
            {
                this.DragMove();
            }
        }
        #endregion
    }
}