Skip to content

Commit

Permalink
feat: Hooked up all of the search option UI controls to be saved as u…
Browse files Browse the repository at this point in the history
…ser settings
  • Loading branch information
deadlydog committed Oct 26, 2020
1 parent 6561de5 commit e4e6177
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/PathLengthCheckerGUI/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" Text="Starting Directory:" ToolTip="The root directory to look for files and/or directories in." />
<TextBox Grid.Column="2" Name="txtRootDirectory" HorizontalAlignment="Stretch" ToolTip="The directory to look for files and/or directories in." />
<TextBox Grid.Column="2" Name="txtRootDirectory" Text="{local:ApplicationSettingsBinding Path=SearchOption_RootDirectory, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" ToolTip="The directory to look for files and/or directories in." />
<Button Grid.Column="3" Content="..." x:Name="btnBrowseForRootDirectory" Click="btnBrowseForRootDirectory_Click" ToolTip="Browse for a folder to search in." />
</Grid>

Expand All @@ -71,9 +71,9 @@
</Grid.ColumnDefinitions>

<TextBlock Grid.Column="0" Text="Include:" Margin="0,0,5,0" VerticalAlignment="Center" ToolTip="The file system types to find and return the path length of." />
<ComboBox Grid.Column="1" Name="cmbTypesToInclude" ItemsSource="{Binding Source={StaticResource FileSystemTypesEnumValues}}" ToolTip="The file system types to find and return the path length of." />
<ComboBox Grid.Column="1" Name="cmbTypesToInclude" ItemsSource="{Binding Source={StaticResource FileSystemTypesEnumValues}}" SelectedValue="{local:ApplicationSettingsBinding Path=SearchOption_FileSystemTypesToInclude}" ToolTip="The file system types to find and return the path length of." />

<CheckBox Grid.Column="3" Content="Include Subdirectories" Name="chkIncludeSubdirectories" IsChecked="True" VerticalAlignment="Center" ToolTip="If enabled it will search for files/directories in all subdirectories of the Starting Directory." />
<CheckBox Grid.Column="3" Content="Include Subdirectories" Name="chkIncludeSubdirectories" IsChecked="{local:ApplicationSettingsBinding Path=SearchOption_IncludeSubdirectories}" VerticalAlignment="Center" ToolTip="If enabled it will search for files/directories in all subdirectories of the Starting Directory." />

<TextBlock Grid.Column="5" Margin="0,0,5,0" Text="Min Path Length:" VerticalAlignment="Center">
<TextBlock.ToolTip>
Expand All @@ -86,7 +86,7 @@
</TextBlock>
</TextBlock.ToolTip>
</TextBlock>
<extToolkit:IntegerUpDown Grid.Column="6" Name="numMinPathLength" Value="0" DefaultValue="0" Minimum="0" Maximum="999999" MinWidth="50">
<extToolkit:IntegerUpDown Grid.Column="6" Name="numMinPathLength" Value="{local:ApplicationSettingsBinding Path=SearchOption_MinPathLength}" DefaultValue="0" Minimum="0" Maximum="999999" MinWidth="50">
<extToolkit:IntegerUpDown.ToolTip>
<TextBlock>
Only paths with this many or more characters will be returned in the search results.
Expand All @@ -107,7 +107,7 @@
</TextBlock>
</TextBlock.ToolTip>
</TextBlock>
<extToolkit:IntegerUpDown Grid.Column="9" DefaultValue="0" Minimum="0" Maximum="999999" MinWidth="50" Name="numMaxPathLength" Value="999999">
<extToolkit:IntegerUpDown Grid.Column="9" Name="numMaxPathLength" Value="{local:ApplicationSettingsBinding Path=SearchOption_MaxPathLength}" DefaultValue="0" Minimum="0" Maximum="999999" MinWidth="50">
<extToolkit:IntegerUpDown.ToolTip>
<TextBlock>
Only paths with this many or less characters will be returned in the search results.
Expand All @@ -120,7 +120,7 @@

<DockPanel Grid.Row="4">
<TextBlock Text="Search Pattern:" Margin="0,0,5,0" ToolTip="Only files/directories that match the given pattern will be returned." />
<TextBox Name="txtSearchPattern" HorizontalAlignment="Stretch" ToolTip="Only files/directories that match the given pattern will be returned. The * is a wildcard." Text="" />
<TextBox Name="txtSearchPattern" Text="{local:ApplicationSettingsBinding Path=SearchOption_SearchPattern, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" ToolTip="Only files/directories that match the given pattern will be returned. The * is a wildcard." />
</DockPanel>

<Grid Grid.Row="6">
Expand All @@ -134,9 +134,9 @@
<ColumnDefinition Width="40" />
</Grid.ColumnDefinitions>

<CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Content="Replace the Starting Directory in the returned paths with:" Name="chkReplaceRootDirectory" ToolTip="If this is not enabled, the Starting Directory will not be modified in the returned paths." />
<CheckBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="3" Content="Replace the Starting Directory in the returned paths with:" Name="chkReplaceRootDirectory" IsChecked="{local:ApplicationSettingsBinding Path=SearchOption_ReplaceRootDirectory}" ToolTip="If this is not enabled, the Starting Directory will not be modified in the returned paths." />

<TextBox Grid.Row="1" Grid.Column="1" Name="txtReplaceRootDirectory" HorizontalAlignment="Stretch" ToolTip="The path to replace the Starting Directory with in the paths that are returned." IsEnabled="{Binding ElementName=chkReplaceRootDirectory, Path=IsChecked}" />
<TextBox Grid.Row="1" Grid.Column="1" Name="txtReplaceRootDirectory" Text="{local:ApplicationSettingsBinding Path=SearchOption_RootDirectoryReplacementText, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Stretch" ToolTip="The path to replace the Starting Directory with in the paths that are returned." IsEnabled="{Binding ElementName=chkReplaceRootDirectory, Path=IsChecked}" />
<Button Grid.Row="1" Grid.Column="2" Content="..." Name="btnBrowseForReplaceRootDirectory" Click="btnBrowseForReplaceRootDirectory_Click" ToolTip="Browse for a path to replace the Starting Directory path with." IsEnabled="{Binding ElementName=chkReplaceRootDirectory, Path=IsChecked}" />
</Grid>

Expand Down
4 changes: 2 additions & 2 deletions src/PathLengthCheckerGUI/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ public MainWindow()
InitializeComponent();
this.DataContext = this;

ResetAllUiSearchOptionsToDefaultValues();

SetWindowTitle();
}

Expand Down Expand Up @@ -367,6 +365,8 @@ private void btnResetSearchOptions_Click(object sender, RoutedEventArgs e)

private void ResetAllUiSearchOptionsToDefaultValues()
{
// Values specified here should match the default values in the Properties\Settings.settings file.

txtRootDirectory.Text = string.Empty;
txtSearchPattern.Text = string.Empty;

Expand Down
96 changes: 96 additions & 0 deletions src/PathLengthCheckerGUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions src/PathLengthCheckerGUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,29 @@
<Setting Name="WindowState" Type="System.String" Scope="User">
<Value Profile="(Default)">Normal</Value>
</Setting>
<Setting Name="SearchOption_RootDirectory" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SearchOption_ReplaceRootDirectory" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="SearchOption_FileSystemTypesToInclude" Type="PathLengthChecker.FileSystemTypes" Scope="User">
<Value Profile="(Default)">All</Value>
</Setting>
<Setting Name="SearchOption_IncludeSubdirectories" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="SearchOption_MinPathLength" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="SearchOption_MaxPathLength" Type="System.Int32" Scope="User">
<Value Profile="(Default)">999999</Value>
</Setting>
<Setting Name="SearchOption_SearchPattern" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="SearchOption_RootDirectoryReplacementText" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>
24 changes: 24 additions & 0 deletions src/PathLengthCheckerGUI/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,30 @@
<setting name="WindowState" serializeAs="String">
<value>Normal</value>
</setting>
<setting name="SearchOption_RootDirectory" serializeAs="String">
<value />
</setting>
<setting name="SearchOption_ReplaceRootDirectory" serializeAs="String">
<value>False</value>
</setting>
<setting name="SearchOption_FileSystemTypesToInclude" serializeAs="String">
<value>All</value>
</setting>
<setting name="SearchOption_IncludeSubdirectories" serializeAs="String">
<value>True</value>
</setting>
<setting name="SearchOption_MinPathLength" serializeAs="String">
<value>0</value>
</setting>
<setting name="SearchOption_MaxPathLength" serializeAs="String">
<value>999999</value>
</setting>
<setting name="SearchOption_SearchPattern" serializeAs="String">
<value />
</setting>
<setting name="SearchOption_RootDirectoryReplacementText" serializeAs="String">
<value />
</setting>
</PathLengthCheckerGUI.Properties.Settings>
</userSettings>
</configuration>

0 comments on commit e4e6177

Please sign in to comment.