2012-08-26 19:03:12 +00:00
using System ;
using System.IO ;
using System.Windows.Forms ;
namespace ANX.ContentCompiler.GUI.Dialogues
{
public partial class NewProjectScreen : Form
{
public NewProjectScreen ( )
{
InitializeComponent ( ) ;
2012-08-27 19:09:10 +00:00
textBoxLocation . Text = Settings . DefaultProjectPath ;
SetUpColors ( ) ;
}
private void SetUpColors ( )
{
BackColor = Settings . MainColor ;
ForeColor = Settings . ForeColor ;
button3 . FlatAppearance . MouseOverBackColor = Settings . LightMainColor ;
buttonBrowse . FlatAppearance . MouseOverBackColor = Settings . LightMainColor ;
buttonCancel . FlatAppearance . MouseOverBackColor = Settings . LightMainColor ;
buttonNext . FlatAppearance . MouseOverBackColor = Settings . LightMainColor ;
button3 . FlatAppearance . MouseDownBackColor = Settings . AccentColor3 ;
buttonBrowse . FlatAppearance . MouseDownBackColor = Settings . AccentColor3 ;
buttonCancel . FlatAppearance . MouseDownBackColor = Settings . AccentColor3 ;
buttonNext . FlatAppearance . MouseDownBackColor = Settings . AccentColor3 ;
buttonNext . FlatAppearance . BorderColor = Settings . LightMainColor ;
button3 . FlatAppearance . BorderColor = Settings . LightMainColor ;
buttonBrowse . FlatAppearance . BorderColor = Settings . LightMainColor ;
buttonCancel . FlatAppearance . BorderColor = Settings . LightMainColor ;
textBoxName . BackColor = Settings . DarkMainColor ;
textBoxLocation . BackColor = Settings . DarkMainColor ;
textBoxName . ForeColor = Settings . ForeColor ;
textBoxLocation . ForeColor = Settings . ForeColor ;
2012-08-26 19:03:12 +00:00
}
private void ButtonBrowseClick ( object sender , EventArgs e )
{
using ( var dlg = new FolderBrowserDialog ( ) )
{
dlg . ShowNewFolderButton = true ;
dlg . Description = "Select Directory to save the uncompiled files in:" ;
dlg . RootFolder = Environment . SpecialFolder . MyComputer ;
if ( dlg . ShowDialog ( ) = = DialogResult . OK )
{
textBoxLocation . Text = dlg . SelectedPath ;
}
}
DialogResult = DialogResult . None ;
}
private void TextBoxNameTextChanged ( object sender , EventArgs e )
{
2012-08-27 19:09:10 +00:00
textBoxLocation . Text = Path . Combine ( Settings . DefaultProjectPath , textBoxName . Text ) ;
2012-08-26 19:03:12 +00:00
}
private void ButtonNextClick ( object sender , EventArgs e )
{
if ( String . IsNullOrEmpty ( textBoxName . Text ) )
MessageBox . Show ( "Give your child a name!" , "Missing value" , MessageBoxButtons . OK , MessageBoxIcon . Warning ) ;
2012-09-01 16:30:35 +00:00
else if ( Directory . Exists ( textBoxLocation . Text ) )
MessageBox . Show ( "A project with this name already exists in that path!" , "Will not overwrite existing stuff" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
2012-08-26 19:03:12 +00:00
else
DialogResult = DialogResult . OK ;
}
}
}