-
Notifications
You must be signed in to change notification settings - Fork 0
/
NewProjectForm.cs
77 lines (68 loc) · 2.04 KB
/
NewProjectForm.cs
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
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;
using System.IO;
namespace MapEditor
{
public delegate void PathPassDelegate(string path);
public partial class NewProjectForm : Form
{
private string temp, folderPath;
PathPassDelegate onCreate;
public NewProjectForm(PathPassDelegate func)
{
InitializeComponent();
onCreate = func;
}
private void NewProjectForm_Load(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
using (var fbd = new FolderBrowserDialog())
{
fbd.Description = "Select New Project Folder.";
DialogResult result = fbd.ShowDialog();
if (result == DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
{
try
{
folderPath = fbd.SelectedPath;
temp = fbd.SelectedPath + "\\" + textBox2.Text;
textBox1.Text = temp;
}
catch(IOException)
{
}
}
}
}
private void button1_Click(object sender, EventArgs e)
{
temp = folderPath + "\\" + textBox2.Text;
if(textBox2.Text == "")
{
MessageBox.Show("Enter Project Name.");
return;
}
onCreate(temp);
Directory.CreateDirectory(temp);
this.Close();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
temp = folderPath + "\\" + textBox2.Text;
textBox1.Text = temp;
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
}
}