Skip to content

Commit

Permalink
Update folder structure
Browse files Browse the repository at this point in the history
  • Loading branch information
srwi committed Nov 13, 2020
1 parent fc8da93 commit 693c220
Show file tree
Hide file tree
Showing 13 changed files with 36 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace EverythingToolbar
{
public class StringToXamlConverter : MarkupExtension, IValueConverter
public class HighlightedTextConverter : MarkupExtension, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Expand Down
3 changes: 0 additions & 3 deletions EverythingToolbar/Rule.cs → EverythingToolbar/Data/Rule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ public bool ExpressionValid
{
get
{
if (string.IsNullOrEmpty(Expression))
return false;

try
{
Regex.IsMatch("", Expression);
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions EverythingToolbar/EverythingToolbar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<DependentUpon>About.xaml</DependentUpon>
</Compile>
<Compile Include="EverythingSearch.cs" />
<Compile Include="Rule.cs" />
<Compile Include="Data\Rule.cs" />
<Compile Include="Rules.xaml.cs">
<DependentUpon>Rules.xaml</DependentUpon>
</Compile>
Expand All @@ -82,8 +82,8 @@
<Compile Include="SearchResultsView.xaml.cs">
<DependentUpon>SearchResultsView.xaml</DependentUpon>
</Compile>
<Compile Include="ToolbarLogger.cs" />
<Compile Include="WindowsThumbnailProvider.cs" />
<Compile Include="Helpers\ToolbarLogger.cs" />
<Compile Include="Helpers\WindowsThumbnailProvider.cs" />
<Page Include="About.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down Expand Up @@ -141,8 +141,8 @@
</Page>
<Compile Include="Deskband.cs" />
<Compile Include="CSDeskBand.cs" />
<Compile Include="SearchResult.cs" />
<Compile Include="StringToXamlConverter.cs" />
<Compile Include="Data\SearchResult.cs" />
<Compile Include="Converters\HighlightedTextConverter.cs" />
<Compile Include="ToolbarControl.xaml.cs">
<DependentUpon>ToolbarControl.xaml</DependentUpon>
<SubType>Code</SubType>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions EverythingToolbar/ItemTemplates/Compact (detailed).xaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
Width="16"
Height="16"
Margin="0, 0, 2, 0" />
<ContentControl Content="{Binding HighlightedFileName, Converter={local:StringToXamlConverter}, Mode=OneTime}"
<ContentControl Content="{Binding HighlightedFileName, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
Grid.Column="1"
FontSize="9pt"
Margin="2, 0"
Foreground="{DynamicResource SearchResultFileName}" />
<ContentControl Content="{Binding HighlightedPath, Converter={local:StringToXamlConverter}, Mode=OneTime}"
<ContentControl Content="{Binding HighlightedPath, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
ToolTip="{Binding Path}"
Grid.Column="2"
FontSize="9pt"
Expand Down
2 changes: 1 addition & 1 deletion EverythingToolbar/ItemTemplates/Compact.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Width="16"
Height="16"
Margin="0, 0, 2, 0" />
<ContentControl Content="{Binding HighlightedFileName, Converter={local:StringToXamlConverter}, Mode=OneTime}"
<ContentControl Content="{Binding HighlightedFileName, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
Grid.Column="1"
FontSize="9pt"
Margin="2, 0"
Expand Down
4 changes: 2 additions & 2 deletions EverythingToolbar/ItemTemplates/Normal (detailed).xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
Width="16"
Height="16"
Margin="0, 5, 0, 0" />
<ContentControl Content="{Binding HighlightedFileName, Converter={local:StringToXamlConverter}, Mode=OneTime}"
<ContentControl Content="{Binding HighlightedFileName, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
Grid.Column="1"
VerticalAlignment="Bottom"
Margin="0, 7, 0, 4"
FontSize="12pt"
Foreground="{DynamicResource SearchResultFileName}" />
<ContentControl Content="{Binding HighlightedPath, Converter={local:StringToXamlConverter}, Mode=OneTime}"
<ContentControl Content="{Binding HighlightedPath, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
ToolTip="{Binding Path}"
Grid.Column="1"
Grid.Row="1"
Expand Down
28 changes: 14 additions & 14 deletions EverythingToolbar/ItemTemplates/Normal.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Image Source="{Binding Icon, IsAsync=True}"
Width="16"
Height="16"
Margin="0, 5, 0, 0" />
<ContentControl Content="{Binding HighlightedFileName, Converter={local:StringToXamlConverter}, Mode=OneTime}"
Grid.Column="1"
VerticalAlignment="Bottom"
Margin="0, 7, 0, 4"
FontSize="12pt"
Foreground="{DynamicResource SearchResultFileName}" />
Width="16"
Height="16"
Margin="0, 5, 0, 0" />
<ContentControl Content="{Binding HighlightedFileName, Converter={local:HighlightedTextConverter}, Mode=OneTime}"
Grid.Column="1"
VerticalAlignment="Bottom"
Margin="0, 7, 0, 4"
FontSize="12pt"
Foreground="{DynamicResource SearchResultFileName}" />
<TextBlock Grid.Column="2"
VerticalAlignment="Bottom"
Margin="10, 5, 10, 6"
FontSize="10pt"
Foreground="{DynamicResource SearchResultDateModified}"
Text="{Binding DateModified}" />
VerticalAlignment="Bottom"
Margin="10, 5, 10, 6"
FontSize="10pt"
Foreground="{DynamicResource SearchResultDateModified}"
Text="{Binding DateModified}" />
</Grid>
</DataTemplate>
</ResourceDictionary>
2 changes: 1 addition & 1 deletion EverythingToolbar/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
2 changes: 1 addition & 1 deletion EverythingToolbar/Rules.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
Use %file%, %filename% and %path% as placeholders for commands.
</TextBlock>

<CheckBox IsChecked="{Binding Source={x:Static properties:Settings.Default}, Path=isAutoApplyRules, Mode=TwoWay}"
<CheckBox Name="autoApplyRulesCheckbox"
Click="CheckBox_Click">
Automatically apply rules based on condition
</CheckBox>
Expand Down
13 changes: 9 additions & 4 deletions EverythingToolbar/Rules.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public Rules()

rules = LoadRules();
dataGrid.ItemsSource = rules;
autoApplyRulesCheckbox.IsChecked = Properties.Settings.Default.isAutoApplyRules;
UpdateUI();
}

Expand All @@ -30,8 +31,12 @@ private void Cancel(object sender, RoutedEventArgs e)

private void Save(object sender, RoutedEventArgs e)
{
if(SaveRules(rules))
if(SaveRules(rules, (bool)autoApplyRulesCheckbox.IsChecked))
{
Properties.Settings.Default.isAutoApplyRules = (bool)autoApplyRulesCheckbox.IsChecked;
Properties.Settings.Default.Save();
Close();
}
}

public static List<Rule> LoadRules()
Expand All @@ -48,14 +53,14 @@ public static List<Rule> LoadRules()
return new List<Rule>();
}

public static bool SaveRules(List<Rule> newRules)
public static bool SaveRules(List<Rule> newRules, bool isAutoApplyRules)
{
if (newRules.Any(r => string.IsNullOrEmpty(r.Name)))
{
MessageBox.Show("Rule names cannot be empty.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return false;
}
if (newRules.Any(r => !r.ExpressionValid))
if (isAutoApplyRules && newRules.Any(r => !r.ExpressionValid))
{
MessageBox.Show("At least one regular expression is invalid.", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
return false;
Expand Down Expand Up @@ -129,7 +134,7 @@ private void UpdateUI()
MoveDownButton.IsEnabled = dataGrid.SelectedIndex + 1 < rules.Count && dataGrid.SelectedIndex >= 0;
MoveUpButton.IsEnabled = dataGrid.SelectedIndex > 0;

if (Properties.Settings.Default.isAutoApplyRules)
if ((bool)autoApplyRulesCheckbox.IsChecked)
{
TypeColumn.Visibility = Visibility.Visible;
ExpressionColumn.Visibility = Visibility.Visible;
Expand Down

0 comments on commit 693c220

Please sign in to comment.