71 lines
2.1 KiB
C#
71 lines
2.1 KiB
C#
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.Insulation
|
|
{
|
|
public partial class BoreSettings : Form
|
|
{
|
|
public List<PipeDiameterOfThickness> BoreList;
|
|
public BoreSettings(List<PipeDiameterOfThickness> lst)
|
|
{
|
|
BoreList = lst;
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void BoreSettings_Load(object sender, EventArgs e)
|
|
{
|
|
this.KeyPreview = true;
|
|
|
|
pipeDiameterOfThicknessBindingSource.DataSource = BoreList;
|
|
}
|
|
|
|
private void textBox_Thickness_TextChanged(object sender, EventArgs e)
|
|
{
|
|
double dblthick = 0;
|
|
double.TryParse(textBox_Thickness.Text, out dblthick);
|
|
|
|
|
|
foreach(DataGridViewCell cell in dataGridView1.SelectedCells)
|
|
{
|
|
var row = dataGridView1.Rows[cell.RowIndex].DataBoundItem as PipeDiameterOfThickness;
|
|
row.dblThickness = dblthick;
|
|
dataGridView1.Rows[cell.RowIndex].Cells[1].Value = dblthick;
|
|
dataGridView1.Refresh();
|
|
}
|
|
}
|
|
|
|
private void BoreSettings_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 textBox_Thickness_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(textBox_Thickness.Text) || textBox_Thickness.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
}
|
|
}
|