using Autodesk.Revit.UI; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace KMBIM { public partial class FormCoilOutAir : Form { public FormCoilOutAir() { InitializeComponent(); } //벽체에서 외기로 판단되는 코일의 수(짝수) private int _OutAirCoilCnt; public int OutAirCoilCnt { get { return _OutAirCoilCnt; } set { _OutAirCoilCnt = value; } } private void FormCoilOutAir_Load(object sender, EventArgs e) { this.KeyPreview = true; //벽체에서 외기로 판단되는 코일의 수(짝수) txt_OutAirCoilCnt.Text = OutAirCoilCnt.ToString(); } //벽체에서 외기로 판단되는 코일의 수(짝수) private void txt_OutAirCoilCnt_TextChanged(object sender, EventArgs e) { if (txt_OutAirCoilCnt.Text == "") return; int inputValue = int.Parse(txt_OutAirCoilCnt.Text); if (inputValue == 0) { TaskDialog.Show("오류", "외기라인을 선택한 경우에는 외기로 판단되는 코일수를 입력해야 합니다."); } else { if (inputValue % 2 != 0) { TaskDialog.Show("오류", "짝수가 아닙니다. 짝수를 입력해주세요."); } else { OutAirCoilCnt = int.Parse(txt_OutAirCoilCnt.Text); } } } private void txt_OutAirCoilCnt_KeyPress(object sender, KeyPressEventArgs e) { //숫자만 입력되도록 필터링 if (!(char.IsDigit(e.KeyChar) || e.KeyChar == Convert.ToChar(Keys.Back))) //숫자와 백스페이스를 제외한 나머지를 바로 처리 { e.Handled = true; } } private void FormCoilOutAir_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { //this.Close(); this.DialogResult = DialogResult.Cancel; } else if (e.KeyCode == Keys.Enter) { this.DialogResult = DialogResult.OK; } } } }