Skip to content

Commit d16f146

Browse files
committed
new project: fix xaml warning, dont allow clicking create project twice
1 parent 024693b commit d16f146

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

UnityLauncherPro/NewProject.xaml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,8 @@
7070
<ColumnDefinition Width="0.7*"/>
7171
<ColumnDefinition Width="*"/>
7272
</Grid.ColumnDefinitions>
73-
<Button Grid.Column="0" Style="{StaticResource CustomButton}" x:Name="btnCancelNewProject" Margin="0,0,3,3" BorderBrush="{x:Null}" VerticalAlignment="Top" Height="35" Click="BtnCancelNewProject_Click" TabIndex="4" >
74-
<Label Content="Cancel" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
75-
</Button>
76-
<Button Grid.Column="1" Style="{StaticResource CustomButton}" x:Name="btnCreateNewProject" Margin="3,0,0,3" BorderBrush="{x:Null}" VerticalAlignment="Top" Height="35" Click="BtnCreateNewProject_Click" TabIndex="3">
77-
<Label Content="_Create Project" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
78-
</Button>
73+
<Button Grid.Column="0" Style="{StaticResource CustomButton}" x:Name="btnCancelNewProject" Margin="0,0,3,3" BorderBrush="{x:Null}" VerticalAlignment="Top" Height="35" Click="BtnCancelNewProject_Click" TabIndex="4" Content="Cancel"/>
74+
<Button Grid.Column="1" Style="{StaticResource CustomButton}" x:Name="btnCreateNewProject" Margin="3,0,0,3" BorderBrush="{x:Null}" VerticalAlignment="Top" Height="35" Click="BtnCreateNewProject_Click" TabIndex="3" Content="_Create Project"/>
7975
</Grid>
8076

8177
<Expander x:Name="expVersionControl" Margin="0,10,0,0" Header="Version Control (Github)" Foreground="{DynamicResource ThemeButtonForeground}" IsExpanded="True" Collapsed="expVersionControl_Collapsed" Expanded="expVersionControl_Collapsed">

UnityLauncherPro/NewProject.xaml.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,18 @@ void UpdateModulesDropdown(string version)
213213
}
214214
}
215215

216+
bool isCreatingProject = false;
216217
private async void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)
217218
{
219+
if (isCreatingProject) return;
220+
isCreatingProject = true;
221+
218222
// check if projectname already exists (only if should be automatically created name)
219223
var targetPath = Path.Combine(targetFolder, txtNewProjectName.Text);
220224
if (txtNewProjectName.IsEnabled == true && Directory.Exists(targetPath) == true)
221225
{
222226
Tools.SetStatus("Project already exists: " + txtNewProjectName.Text);
227+
isCreatingProject = false;
223228
return;
224229
}
225230

@@ -245,12 +250,14 @@ private async void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)
245250
if (!File.Exists(templateZipPath))
246251
{
247252
Tools.SetStatus("Selected online template is not downloaded. Please download it first.");
253+
isCreatingProject = false;
248254
return;
249255
}
250256
}
251257
else
252258
{
253259
Tools.SetStatus("Invalid online template URL");
260+
isCreatingProject = false;
254261
return;
255262
}
256263
}
@@ -359,8 +366,6 @@ private async void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)
359366
}
360367
}
361368

362-
363-
364369
// download .gitignore if enabled
365370
if (chkAddUnityGitIgnore.IsChecked == true)
366371
{
@@ -413,6 +418,7 @@ private async void BtnCreateNewProject_Click(object sender, RoutedEventArgs e)
413418
} // if version control enabled
414419

415420
btnCreateNewProject.IsEnabled = true;
421+
isCreatingProject = false;
416422

417423
DialogResult = true;
418424
} // BtnCreateNewProject_Click

0 commit comments

Comments
 (0)