Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf5f31c0

Browse files
committed
new project: Add "Create missing folder" button to create folders from your given path input field#201
1 parentd1e709d commitf5f31c0

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

‎UnityLauncherPro/NewProject.xaml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@
4949
<Grid.ColumnDefinitions>
5050
<ColumnDefinitionWidth="18*"/>
5151
<ColumnDefinitionWidth="*"/>
52+
<ColumnDefinitionWidth="*"/>
5253
</Grid.ColumnDefinitions>
5354
<TextBox Grid.Column="0"x:Name="txtNewProjectFolder"VerticalAlignment="Center"IsUndoEnabled="True"TextChanged="txtNewProjectFolder_TextChanged"PreviewKeyDown="TxtNewProjectName_PreviewKeyDown"TabIndex="0"Margin="0,2,6,2" />
5455
<Button Grid.Column="1"x:Name="btnBrowseForProjectFolder"Style="{StaticResource CustomButton}"ToolTip="Browse for New Project folder"Content="..."Height="22"Width="22"HorizontalAlignment="Right"VerticalAlignment="Top"FontSize="16"Padding="1,-2,1,1"BorderBrush="{x:Null}"Click="btnBrowseForProjectFolder_Click"/>
56+
<Button Grid.Column="2"x:Name="btnCreateMissingFolder"Style="{StaticResource CustomButton}"ToolTip="Create Missing Folder from your path"Content="+"Height="22"Width="22"HorizontalAlignment="Right"VerticalAlignment="Top"FontSize="16"Padding="1,-2,1,1"BorderBrush="{x:Null}"Click="btnCreateMissingFolder_Click"/>
5557
</Grid>
5658

5759
<!--<Label x:Name="lblNewProjectFolder" Content="(folder)" Foreground="{DynamicResource ThemeButtonForegroundDisabled}" Margin="0" FontSize="10" Padding="5,0,5,3" />-->
@@ -64,7 +66,7 @@
6466
<LabelContent="Cancel"Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
6567
</Button>
6668
<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">
67-
<LabelContent="_Create"Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
69+
<LabelContent="_Create Project"Foreground="{Binding RelativeSource={RelativeSource AncestorType=Button}, Path=Foreground}"/>
6870
</Button>
6971
</Grid>
7072

‎UnityLauncherPro/NewProject.xaml.cs‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,29 @@ private void txtNewProjectFolder_TextChanged(object sender, TextChangedEventArgs
373373
{
374374
txtNewProjectFolder.BorderBrush=Brushes.Red;// not visible if focused
375375
btnCreateNewProject.IsEnabled=false;
376+
btnCreateMissingFolder.IsEnabled=true;
376377
}
377378
else
378379
{
379380
txtNewProjectFolder.BorderBrush=null;
380381
btnCreateNewProject.IsEnabled=true;
381382
targetFolder=txtNewProjectFolder.Text;
383+
btnCreateMissingFolder.IsEnabled=false;
384+
}
385+
}
386+
387+
privatevoidbtnCreateMissingFolder_Click(objectsender,RoutedEventArgse)
388+
{
389+
try
390+
{
391+
Directory.CreateDirectory(txtNewProjectFolder.Text);
392+
txtNewProjectFolder.BorderBrush=null;
393+
btnCreateNewProject.IsEnabled=true;
394+
targetFolder=txtNewProjectFolder.Text;
395+
}
396+
catch(Exceptionex)
397+
{
398+
Tools.SetStatus("Failed to create folder: "+ex.Message);
382399
}
383400
}
384401
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp