106 lines
3.1 KiB
C#
106 lines
3.1 KiB
C#
using KDCS.Utils;
|
|
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 Form_TrimSpacing : Form
|
|
{
|
|
public double m_trimDist = 0;
|
|
public string m_label = "";
|
|
public Form_TrimSpacing()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void Form_TrimSpacing_Load(object sender, EventArgs e)
|
|
{
|
|
this.KeyPreview = true;
|
|
|
|
//txt_TS_trim.Text = m_trimDist.ToString();
|
|
label2.Text = m_label;
|
|
|
|
if(label2.Text == "m")//파이프는 m
|
|
{
|
|
if (Reg.getReg("Trim_Pipe_Length") == "")
|
|
{
|
|
Reg.setReg("Trim_Pipe_Length", m_trimDist.ToString());
|
|
txt_TS_trim.Text = m_trimDist.ToString();
|
|
}
|
|
else
|
|
{
|
|
string str_PipeLength = Reg.getReg("Trim_Pipe_Length");
|
|
txt_TS_trim.Text = str_PipeLength;
|
|
}
|
|
}
|
|
else if(label2.Text == "mm")//덕트는 mm
|
|
{
|
|
if (Reg.getReg("Trim_Duct_Length") == "")
|
|
{
|
|
Reg.setReg("Trim_Duct_Length", m_trimDist.ToString());
|
|
txt_TS_trim.Text = m_trimDist.ToString();
|
|
}
|
|
else
|
|
{
|
|
string str_DuctLength = Reg.getReg("Trim_Duct_Length");
|
|
txt_TS_trim.Text = str_DuctLength;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
private void Form_TrimSpacing_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 txt_TS_trim_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(txt_TS_trim.Text) || txt_TS_trim.Text.Contains('.') == true)
|
|
e.Handled = true;
|
|
}
|
|
}
|
|
|
|
private void txt_TS_trim_TextChanged(object sender, EventArgs e)
|
|
{
|
|
if (txt_TS_trim.Text == "") return;
|
|
if (txt_TS_trim.Text != "-")
|
|
{
|
|
m_trimDist = double.Parse(txt_TS_trim.Text);
|
|
if (label2.Text == "m")//파이프는 m
|
|
{
|
|
Reg.setReg("Trim_Pipe_Length", m_trimDist.ToString());
|
|
}
|
|
else if (label2.Text == "mm")//파이프는 m
|
|
{
|
|
Reg.setReg("Trim_Duct_Length", m_trimDist.ToString());
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|