d23004
2023-05-24 fa87a558389d9d425f70afa1c8de54c69875ef2c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
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 FoupRecipeCreateViewer : Form
    {
        public string RecipeName { get; set; }
 
        public FoupRecipeCreateViewer()
        {
            InitializeComponent();
            RecipeName = string.Empty;
        }
 
        private void btn_Ok_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();
        }
 
        private void tb_Name_Leave(object sender, EventArgs e)
        {
            SetSettingData(sender);
        }
 
        private void tb_Name_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyData == Keys.Enter)
            {
                SetSettingData(sender);
            }
        }
 
        private void SetSettingData(object sender)
        {
            Control control = (Control)sender;
 
            switch (control.Name)
            {
                case "tb_Name":
                    {
                        RecipeName = control.Text;
                        break;
                    }
            }
        }
    }
}