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 } }