Adjust popup in explorer plugin with string

Fix Color
This commit is contained in:
DB p 2021-12-06 11:59:21 +09:00
parent 06a76f53dc
commit b83bbb5923
5 changed files with 245 additions and 88 deletions

View file

@ -29,7 +29,7 @@
<system:String x:Key="plugin_explorer_actionkeywordview_filecontentsearch">File Content Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_indexsearch">Index Search:</system:String>
<system:String x:Key="plugin_explorer_actionkeywordview_quickaccess">Quick Access:</system:String>
<system:String x:Key="plugin_explorer_actionkeyword_current">Current Action Keyword:</system:String>
<system:String x:Key="plugin_explorer_actionkeyword_current">Current Action Keyword</system:String>
<system:String x:Key="plugin_explorer_actionkeyword_done">Done</system:String>
<system:String x:Key="plugin_explorer_actionkeyword_enabled">Enabled</system:String>
<system:String x:Key="plugin_explorer_actionkeyword_enabled_tooltip">When disabled Flow will not execute this search option, and will additionally revert back to '*' to free up the action keyword</system:String>

View file

@ -1,39 +1,129 @@
<Window x:Class="Flow.Launcher.Plugin.Explorer.Views.ActionKeywordSetting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
mc:Ignorable="d"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Title="Action Keyword Setting" Height="200" Width="500">
<Window
x:Class="Flow.Launcher.Plugin.Explorer.Views.ActionKeywordSetting"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="{DynamicResource plugin_explorer_manageactionkeywords_header}"
Width="400"
SizeToContent="Height"
Background="{DynamicResource PopuBGColor}"
DataContext="{Binding RelativeSource={RelativeSource Self}}"
Foreground="{DynamicResource PopupTextColor}"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="180" />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock Margin="20 10 10 10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
HorizontalAlignment="Left" Text="{DynamicResource plugin_explorer_actionkeyword_current}" />
<TextBox Name="TxtCurrentActionKeyword"
Margin="10" Grid.Row="0" Width="105" Grid.Column="1"
VerticalAlignment="Center"
HorizontalAlignment="Left"
Text="{Binding ActionKeyword}"
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"/>
<CheckBox Name="ChkActionKeywordEnabled" ToolTip="{DynamicResource plugin_explorer_actionkeyword_enabled_tooltip}"
Margin="10" Grid.Row="0" Grid.Column="2" Content="{DynamicResource plugin_explorer_actionkeyword_enabled}"
Width="auto"
VerticalAlignment="Center" IsChecked="{Binding Enabled}" />
<Button Name="DownButton"
Click="OnDoneButtonClick" Grid.Row="1" Grid.Column="2"
Margin="10 0 10 0" Width="80" Height="35"
Content="{DynamicResource plugin_explorer_actionkeyword_done}" />
<StackPanel Grid.Row="0">
<StackPanel>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="4"
Click="BtnCancel_OnClick"
Style="{StaticResource TitleBarCloseButtonStyle}">
<Path
Width="46"
Height="32"
Data="M 18,11 27,20 M 18,20 27,11"
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
StrokeThickness="1">
<Path.Style>
<Style TargetType="Path">
<Style.Triggers>
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
<Setter Property="Opacity" Value="0.5" />
</DataTrigger>
</Style.Triggers>
</Style>
</Path.Style>
</Path>
</Button>
</Grid>
</StackPanel>
<StackPanel Margin="26,0,26,0">
<StackPanel Margin="0,0,0,12">
<TextBlock
Margin="0,0,0,0"
FontFamily="Segoe UI"
FontSize="20"
FontWeight="SemiBold"
Text="{DynamicResource plugin_explorer_manageactionkeywords_header}"
TextAlignment="Left" />
</StackPanel>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock
Width="150"
Margin="0,10,15,10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource plugin_explorer_actionkeyword_current}" />
<TextBox
Name="TxtCurrentActionKeyword"
Grid.Row="0"
Grid.Column="1"
Width="105"
HorizontalAlignment="Left"
VerticalAlignment="Center"
PreviewKeyDown="TxtCurrentActionKeyword_OnKeyDown"
Text="{Binding ActionKeyword}" />
</StackPanel>
<StackPanel Margin="0,10,0,15" Orientation="Horizontal">
<TextBlock Margin="0 0 15 0 "
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Width="150"
Text="{DynamicResource plugin_explorer_actionkeyword_enabled}" />
<CheckBox
Name="ChkActionKeywordEnabled"
Width="auto"
VerticalAlignment="Center"
IsChecked="{Binding Enabled}"
ToolTip="{DynamicResource plugin_explorer_actionkeyword_enabled_tooltip}" />
</StackPanel>
</StackPanel>
</StackPanel>
<Border
Grid.Row="1"
Background="{DynamicResource PopupButtonAreaBGColor}"
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
BorderThickness="0,1,0,0">
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
<Button
x:Name="btnCancel"
Width="145"
Height="30"
Margin="0,0,5,0"
Click="BtnCancel_OnClick"
Content="{DynamicResource cancel}" />
<Button
Name="DownButton"
Width="145"
Height="30"
Margin="5,0,0,0"
Click="OnDoneButtonClick"
Style="{StaticResource AccentButtonStyle}">
<TextBlock x:Name="lblAdd" Text="{DynamicResource plugin_explorer_actionkeyword_done}" />
</Button>
</StackPanel>
</Border>
</Grid>
</Window>

View file

@ -100,6 +100,10 @@ namespace Flow.Launcher.Plugin.Explorer.Views
MessageBox.Show(settingsViewModel.Context.API.GetTranslation("newActionKeywordsHasBeenAssigned"));
}
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
{
Close();
}
private void TxtCurrentActionKeyword_OnKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)

View file

@ -1,82 +1,145 @@
<UserControl x:Class="Flow.Launcher.Plugin.Explorer.Views.ExplorerSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels"
xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="Flow.Launcher.Plugin.Explorer.Views.ExplorerSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Explorer.ViewModels"
xmlns:views="clr-namespace:Flow.Launcher.Plugin.Explorer.Views"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<DataTemplate x:Key="ListViewTemplateAccessLinks">
<TextBlock
Text="{Binding Path, Mode=OneTime}"
Margin="0,5,0,5" />
<TextBlock Margin="0,5,0,5" Text="{Binding Path, Mode=OneTime}" />
</DataTemplate>
<DataTemplate x:Key="ListViewTemplateExcludedPaths">
<TextBlock
Text="{Binding Path, Mode=OneTime}"
Margin="0,5,0,5" />
<TextBlock Margin="0,5,0,5" Text="{Binding Path, Mode=OneTime}" />
</DataTemplate>
<DataTemplate x:Key="ListViewActionKeywords"
DataType="views:ActionKeywordView">
<DataTemplate x:Key="ListViewActionKeywords" DataType="views:ActionKeywordView">
<Grid>
<TextBlock
Text="{Binding Description, Mode=OneTime}"
Foreground="{Binding Color, Mode=OneWay}"
Margin="0,5,0,0" />
<TextBlock
Text="{Binding Keyword, Mode=OneTime}"
Foreground="{Binding Color, Mode=OneWay}"
Margin="250,5,0,0" />
<TextBlock
Margin="0,5,0,0"
IsEnabled="{Binding Enabled}"
Text="{Binding Description, Mode=OneTime}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource Color18B}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
<TextBlock
Margin="250,5,0,0"
IsEnabled="{Binding Enabled}"
Text="{Binding Keyword, Mode=OneTime}">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="True">
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{DynamicResource Color18B}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DataTemplate>
</UserControl.Resources>
<Grid Margin="10">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="100"/>
<RowDefinition Height="*" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<ScrollViewer Margin="20 35 0 0" HorizontalScrollBarVisibility="Hidden" Grid.Row="0" VerticalScrollBarVisibility="Auto">
<ScrollViewer
Grid.Row="0"
Margin="20,35,0,0"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Auto">
<StackPanel>
<Expander Name="expActionKeywords" Header="{DynamicResource plugin_explorer_manageactionkeywords_header}"
Expanded="expActionKeywords_Click" Collapsed="expActionKeywords_Collapsed">
<ListView x:Name="lbxActionKeywords"
ItemTemplate="{StaticResource ListViewActionKeywords}"/>
<Expander
Name="expActionKeywords"
Collapsed="expActionKeywords_Collapsed"
Expanded="expActionKeywords_Click"
Header="{DynamicResource plugin_explorer_manageactionkeywords_header}">
<ListView x:Name="lbxActionKeywords" ItemTemplate="{StaticResource ListViewActionKeywords}" />
</Expander>
<Expander Name="expAccessLinks" Header="{DynamicResource plugin_explorer_quickaccesslinks_header}"
Expanded="expAccessLinks_Click" Collapsed="expAccessLinks_Collapsed"
Margin="0 10 0 0">
<Expander
Name="expAccessLinks"
Margin="0,10,0,0"
Collapsed="expAccessLinks_Collapsed"
Expanded="expAccessLinks_Click"
Header="{DynamicResource plugin_explorer_quickaccesslinks_header}">
<ListView
x:Name="lbxAccessLinks" AllowDrop="True"
Drop="lbxAccessLinks_Drop"
x:Name="lbxAccessLinks"
AllowDrop="True"
DragEnter="lbxAccessLinks_DragEnter"
ItemTemplate="{StaticResource ListViewTemplateAccessLinks}"/>
Drop="lbxAccessLinks_Drop"
ItemTemplate="{StaticResource ListViewTemplateAccessLinks}" />
</Expander>
<Expander x:Name="expExcludedPaths" Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}"
Expanded="expExcludedPaths_Click"
Margin="0 10 0 0">
<Expander
x:Name="expExcludedPaths"
Margin="0,10,0,0"
Expanded="expExcludedPaths_Click"
Header="{DynamicResource plugin_explorer_indexsearchexcludedpaths_header}">
<ListView
x:Name="lbxExcludedPaths" AllowDrop="True"
Drop="lbxAccessLinks_Drop"
x:Name="lbxExcludedPaths"
AllowDrop="True"
DragEnter="lbxAccessLinks_DragEnter"
ItemTemplate="{StaticResource ListViewTemplateExcludedPaths}"/>
Drop="lbxAccessLinks_Drop"
ItemTemplate="{StaticResource ListViewTemplateExcludedPaths}" />
</Expander>
</StackPanel>
</ScrollViewer>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="350"/>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="350" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Row="1" Grid.Column="0" HorizontalAlignment="Left" Orientation="Horizontal">
<Button x:Name="btnIndexingOptions" Click="btnOpenIndexingOptions_Click" Width="130" Margin="10"
Content="{DynamicResource plugin_explorer_manageindexoptions}"/>
<StackPanel
Grid.Row="1"
Grid.Column="0"
HorizontalAlignment="Left"
Orientation="Horizontal">
<Button
x:Name="btnIndexingOptions"
Width="130"
Margin="10"
Click="btnOpenIndexingOptions_Click"
Content="{DynamicResource plugin_explorer_manageindexoptions}" />
</StackPanel>
<StackPanel Grid.Row="1" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button x:Name="btnDelete" Click="btnDelete_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_delete}"/>
<Button x:Name="btnEdit" Click="btnEdit_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_edit}"/>
<Button x:Name="btnAdd" Click="btnAdd_Click" Width="100" Margin="10" Content="{DynamicResource plugin_explorer_add}"/>
<StackPanel
Grid.Row="1"
Grid.Column="1"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
x:Name="btnDelete"
Width="100"
Margin="10"
Click="btnDelete_Click"
Content="{DynamicResource plugin_explorer_delete}" />
<Button
x:Name="btnEdit"
Width="100"
Margin="10"
Click="btnEdit_Click"
Content="{DynamicResource plugin_explorer_edit}" />
<Button
x:Name="btnAdd"
Width="100"
Margin="10"
Click="btnAdd_Click"
Content="{DynamicResource plugin_explorer_add}" />
</StackPanel>
</Grid>
</Grid>

View file

@ -327,7 +327,7 @@ namespace Flow.Launcher.Plugin.Explorer.Views
}
public string Description { get; private init; }
public string Color => Enabled ? "Black" : "Gray";
public string Color => Enabled ? "True" : "False";
internal Settings.ActionKeyword KeywordProperty { get; }