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 SA_LTT_UI.Viewer
|
{
|
public partial class RecipeCreateViewer : Form
|
{
|
public string RecipeName { get; set; }
|
|
public float Radius { get; set; }
|
|
public float DistancePrimaryFlat { get; set; }
|
|
public float EdgeRound { get; set; }
|
|
public RecipeCreateViewer()
|
{
|
InitializeComponent();
|
RecipeName = string.Empty;
|
Radius = 75;
|
DistancePrimaryFlat = 70;
|
EdgeRound = 0;
|
}
|
|
public void SetCopyVersion(float radius, float distancePrimaryFlat, float edgeRound)
|
{
|
tb_Radius.Text = $"{radius}";
|
tb_DistancePrimaryFlat.Text = $"{distancePrimaryFlat}";
|
tb_EdgeRound.Text = $"{edgeRound}";
|
tb_Radius.Enabled = false;
|
tb_DistancePrimaryFlat.Enabled = false;
|
tb_EdgeRound.Enabled = false;
|
}
|
|
private void SettingData_Leave(object sender, EventArgs e)
|
{
|
SetSettingData(sender);
|
}
|
|
private void SettingData_KeyDown(object sender, KeyEventArgs e)
|
{
|
if (e.KeyData == Keys.Enter)
|
{
|
SetSettingData(sender);
|
}
|
}
|
|
private void SetSettingData(object sender)
|
{
|
Control control = (Control)sender;
|
float floatValue;
|
|
switch(control.Name)
|
{
|
case "tb_Name":
|
{
|
RecipeName = control.Text;
|
break;
|
}
|
|
case "tb_Radius":
|
{
|
float.TryParse(tb_Radius.Text, out floatValue);
|
|
if(floatValue < 50)
|
{
|
floatValue = 50;
|
}
|
|
Radius = floatValue;
|
|
if (DistancePrimaryFlat > Radius)
|
{
|
DistancePrimaryFlat = Radius;
|
control.Text = $"{DistancePrimaryFlat}";
|
}
|
|
control.Text = $"{Radius}";
|
|
break;
|
}
|
case "tb_DistancePrimaryFlat":
|
{
|
float.TryParse(tb_DistancePrimaryFlat.Text, out floatValue);
|
|
DistancePrimaryFlat = floatValue;
|
|
if(DistancePrimaryFlat > Radius)
|
{
|
DistancePrimaryFlat = Radius;
|
}
|
|
control.Text = $"{DistancePrimaryFlat}";
|
break;
|
}
|
case "tb_EdgeRound":
|
{
|
float.TryParse(tb_EdgeRound.Text, out floatValue);
|
|
EdgeRound = floatValue;
|
|
if (EdgeRound > Radius)
|
{
|
EdgeRound = Radius;
|
}
|
|
control.Text = $"{EdgeRound}";
|
|
break;
|
}
|
}
|
}
|
|
private void btn_Create_Click(object sender, EventArgs e)
|
{
|
if (RecipeName == string.Empty)
|
{
|
MessageBoxPad messageBox = new MessageBoxPad("이름이 비어있습니다.");
|
messageBox.Show();
|
}
|
else
|
{
|
char[] nameExceptList = new char[] { '\\', '/', ':', '*', '?', '"', '<', '>', '|' };
|
|
foreach(char exceptChar in nameExceptList)
|
{
|
if(RecipeName.Contains(exceptChar))
|
{
|
MessageBoxPad messageBox = new MessageBoxPad("파일 이름에는 다음 문자를 사용할 수 없습니다. \r\n \\ / : * ? \" < > | ");
|
messageBox.Show();
|
return;
|
}
|
}
|
|
DialogResult = DialogResult.OK;
|
this.Close();
|
}
|
}
|
|
private void btn_Cancel_Click(object sender, EventArgs e)
|
{
|
RecipeName = string.Empty;
|
DialogResult = DialogResult.Cancel;
|
this.Close();
|
}
|
}
|
}
|