천호석
2022-12-02 0ea3c195df71c3e26bf341d095d209b4d8e4c562
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
using System;
using System.Windows.Forms;
 
namespace SHARP_CLAS_UI
{
    public partial class Form_Tray_Count_Set : Form
    {
        #region Property
        public int Count { get; private set; }
        #endregion
 
        #region Construct
        public Form_Tray_Count_Set(string name, int current_count, bool limit_sensor_detected = false)
        {
            InitializeComponent();
            this.DialogResult = DialogResult.None;
 
            this.Text = name;
            if (limit_sensor_detected)
                lb_Description.Text = "Limit sensor is detected.";
            else
                lb_Description.Text = "Tray sensor is not detected.";
 
            tb_Current_Tray_Count.Text = current_count.ToString();
 
            Count = 0;
        }
        #endregion
 
        #region Form Function
        private void btn_OK_Click(object sender, EventArgs e)
        {
            int count = 0;
            
            if(int.TryParse(nud_Set_Tray_Count.Value.ToString(), out count))
            {
                if (count == 0) return;
 
                Count = count;
                this.DialogResult = DialogResult.OK;
                this.Hide();
            }
        }
        #endregion
    }
}