using KDCS.Utils; using KMBIM.Revit.Tools.Cmd.Insulation; using KMBIM.Revit.Tools.LogicClass; 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.Revit.Tools.Cmd.Sleeve { public partial class FormSleeve : Form { public bool Insulation { get; set; } public bool bKeepInsulation { get; set; } public double dPipeOffsetValue { set; get; } public double dDuctOffsetValue { set; get; } public List mlstString1 = new List(); public List mlstString2 = new List(); public bool mbRes = false; public bool bApplyPipe = false; public bool bApplyDuct = false; TblDataStorage PipeData = null; public FormSleeve(List lstString1, List lstString2, TblDataStorage PipeData) { InitializeComponent(); txtPipeOffset.Text = "50"; txtDuctOffset.Text = "50"; mlstString1 = lstString1; mlstString2 = lstString2; this.PipeData = PipeData; } private void FormSleeve_Load(object sender, EventArgs e) { this.KeyPreview = true; mbRes = false; checkBox1.Checked = true; foreach (string str in mlstString1) checkedListBox1.Items.Add(str, true); checkBox2.Checked = true; foreach (string str in mlstString2) checkedListBox2.Items.Add(str, true); string category = Reg.getReg("kdcsInsulationDefaultType"); if (category.CompareTo("") == 0) { Reg.setReg("kdcsInsulationDefaultType", "기본"); category = "기본"; } PipedataStorageBindingSource.DataSource = PipeData.GetTable(category, true); DuctdataStorageBindingSource.DataSource = PipeData.GetTable(category, false); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { // 전체선택 체크박스 1 // 모든 항목 체크 또는 해제 for (int i = 0; i < checkedListBox1.Items.Count; i++) checkedListBox1.SetItemChecked(i, checkBox1.Checked); } private void checkBox2_CheckedChanged(object sender, EventArgs e) { // 전체선택 체크박스 2 // 모든 항목 체크 또는 해제 for (int i = 0; i < checkedListBox2.Items.Count; i++) checkedListBox2.SetItemChecked(i, checkBox2.Checked); } private void buttonOK_Click(object sender, EventArgs e) { dPipeOffsetValue = 0d; dDuctOffsetValue = 0d; double dblVal = 0d; Insulation = this.checkBoxInsulation.Checked; bKeepInsulation = this.ckKeepInsulation.Checked; bApplyDuct = this.ckDuct.Checked; bApplyPipe = this.ckPipe.Checked; if (double.TryParse(txtPipeOffset.Text, out dblVal)) dPipeOffsetValue = dblVal; dblVal = 0d; if (double.TryParse(txtDuctOffset.Text, out dblVal)) dDuctOffsetValue = dblVal; mlstString1.Clear(); for (int i = 0; i < checkedListBox1.Items.Count; i++) if (checkedListBox1.GetItemChecked(i)) mlstString1.Add(checkedListBox1.Items[i].ToString()); mlstString2.Clear(); for (int i = 0; i < checkedListBox2.Items.Count; i++) if (checkedListBox2.GetItemChecked(i)) mlstString2.Add(checkedListBox2.Items[i].ToString()); mbRes = true; } private void buttonCancel_Click(object sender, EventArgs e) { } private void checkBoxInsulation_CheckedChanged(object sender, EventArgs e) { if(checkBoxInsulation.Checked) { ckKeepInsulation.Enabled = true; this.Width = 982; } else { ckKeepInsulation.Checked = false; ckKeepInsulation.Enabled = false; this.Width = 592; } } private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 2) { DataStorage row = dataGridView1.Rows[e.RowIndex].DataBoundItem as DataStorage; BoreSettings dlg = new BoreSettings(row.BoreList); if (dlg.ShowDialog() == DialogResult.OK) { row.BoreList = dlg.BoreList; } } } private void textBox_Thickness_TextChanged(object sender, EventArgs e) { double dblthick = 0; double.TryParse(textBox_Thickness.Text, out dblthick); foreach (DataGridViewCell cell in dataGridView2.SelectedCells) { var row = dataGridView2.Rows[cell.RowIndex].DataBoundItem as DataStorage; row.dblLaggingThickness = dblthick; dataGridView2.Rows[cell.RowIndex].Cells[2].Value = dblthick; dataGridView2.Refresh(); } } //배관 여유공간 private void txtPipeOffset_TextChanged(object sender, EventArgs e) { if (txtPipeOffset.Text == "") return; if (txtPipeOffset.Text != "-") Reg.setReg("Sleeve_PipeOffset", txtPipeOffset.Text); } //덕트 여유공간 private void txtDuctOffset_TextChanged(object sender, EventArgs e) { if (txtDuctOffset.Text == "") return; if (txtDuctOffset.Text != "-") Reg.setReg("Sleeve_DuctOffset", txtDuctOffset.Text); } private void FormSleeve_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { this.DialogResult = DialogResult.Cancel; } else if (e.KeyCode == Keys.Enter) { this.DialogResult = DialogResult.OK; } } private void txtPipeOffset_KeyPress(object sender, KeyPressEventArgs e) { int keyCode = (int)e.KeyChar; if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46) e.Handled = true; if (keyCode == 46) { if (string.IsNullOrEmpty(txtPipeOffset.Text) || txtPipeOffset.Text.Contains('.') == true) e.Handled = true; } } private void txtDuctOffset_KeyPress(object sender, KeyPressEventArgs e) { int keyCode = (int)e.KeyChar; if ((keyCode < 48 || keyCode > 57) && keyCode != 8 && keyCode != 46) e.Handled = true; if (keyCode == 46) { if (string.IsNullOrEmpty(txtDuctOffset.Text) || txtDuctOffset.Text.Contains('.') == true) e.Handled = true; } } public bool bPenetrate() { if (radioButton1.Checked) return true; else return false; } } }