- Change CustomQueryHotkey's HotkeyControl to popup

- Remove WelcomePage2's Hotkeycontrol
This commit is contained in:
DB p 2024-04-21 17:21:17 +09:00
parent f2399da50d
commit b93aa8ecf0
5 changed files with 19 additions and 59 deletions

View file

@ -78,7 +78,7 @@
Margin="0,20,0,0"
Source="/Images/illustration_01.png" />
<Grid Margin="0,20,0,0" Width="478">
<Grid Width="478" Margin="0,20,0,0">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
@ -97,25 +97,16 @@
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource hotkey}" />
<flowlauncher:HotkeyControl
<flowlauncher:HotkeyControl2
x:Name="HotkeyControl"
Grid.Row="0"
Grid.Column="1"
Grid.ColumnSpan="2"
x:Name="HotkeyControl"
DefaultHotkey=""
Margin="10,0,10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
HorizontalContentAlignment="Left" />
<!--<TextBlock
Grid.Row="0"
Grid.Column="2"
Margin="10"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="14"
Text="{DynamicResource actionKeyword}" />-->
HorizontalContentAlignment="Left"
DefaultHotkey="" />
<TextBlock
Grid.Row="1"
Grid.Column="0"
@ -125,16 +116,16 @@
FontSize="14"
Text="{DynamicResource customQuery}" />
<TextBox
x:Name="tbAction"
Grid.Row="1"
Grid.Column="1"
x:Name="tbAction"
Margin="10"
HorizontalAlignment="Stretch"
VerticalAlignment="Center" />
<Button
x:Name="btnTestActionKeyword"
Grid.Row="1"
Grid.Column="2"
x:Name="btnTestActionKeyword"
Margin="0,0,10,0"
Padding="10,5,10,5"
Click="BtnTestActionKeyword_OnClick"

View file

@ -31,11 +31,6 @@ namespace Flow.Launcher
private void btnAdd_OnClick(object sender, RoutedEventArgs e)
{
if (HotkeyControl.IsEmpty)
{
MessageBox.Show("Hotkey cannot be empty.");
return;
}
if (!update)
{
_settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>();

View file

@ -9,8 +9,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
Title="WelcomePage2"
mc:Ignorable="d"
DataContext="{Binding RelativeSource={RelativeSource Self}}">
DataContext="{Binding RelativeSource={RelativeSource Self}}"
mc:Ignorable="d">
<Page.Resources>
<converters:BorderClipConverter x:Key="BorderClipConverter" />
<Style x:Key="StyleImageFadeIn" TargetType="{x:Type Image}">
@ -110,13 +110,13 @@
FontSize="14"
FontWeight="SemiBold"
Text="{DynamicResource flowlauncherHotkey}" />
<flowlauncher:HotkeyControl
x:Name="HotkeyControl"
Width="300"
Height="35"
Margin="-206,10,0,0"
GotFocus="HotkeyControl_OnGotFocus"
LostFocus="HotkeyControl_OnLostFocus"/>
<flowlauncher:HotkeyControl2
Margin="0,8,0,0"
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
DefaultHotkey="Alt+Space"
Hotkey="{Binding Settings.Hotkey}"
ValidateKeyGesture="True"
WindowTitle="{DynamicResource flowlauncherHotkey}" />
</StackPanel>
</StackPanel>

View file

@ -14,10 +14,6 @@ namespace Flow.Launcher.Resources.Pages
{
private Settings Settings { get; set; }
private Brush tbMsgForegroundColorOriginal;
private string tbMsgTextOriginal;
protected override void OnNavigatedTo(NavigationEventArgs e)
{
if (e.ExtraData is Settings settings)
@ -26,29 +22,7 @@ namespace Flow.Launcher.Resources.Pages
throw new ArgumentException("Unexpected Parameter setting.");
InitializeComponent();
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
HotkeyControl.ChangeHotkey = ChangeHotkeyCommand;
}
[RelayCommand]
public void ChangeHotkey(HotkeyModel hotkeyModel)
{
Settings.Hotkey = hotkeyModel.ToString();
HotKeyMapper.SetHotkey(hotkeyModel, HotKeyMapper.OnToggleHotkey);
}
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
{
HotKeyMapper.RemoveHotkey(Settings.Hotkey);
}
private void HotkeyControl_OnLostFocus(object sender, RoutedEventArgs args)
{
HotkeyControl.tbMsg.Text = tbMsgTextOriginal;
HotkeyControl.tbMsg.Foreground = tbMsgForegroundColorOriginal;
}
}
}

View file

@ -2641,7 +2641,7 @@
Title="{DynamicResource flowlauncherHotkey}"
Icon="&#xeda7;"
Sub="{DynamicResource flowlauncherHotkeyToolTip}">
<flowlauncher:HotkeyControl2
<flowlauncher:HotkeyControl2
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
DefaultHotkey="Alt+Space"
Hotkey="{Binding Settings.Hotkey}"
@ -2655,11 +2655,11 @@
Title="{DynamicResource previewHotkey}"
Icon="&#xe8a1;"
Sub="{DynamicResource previewHotkeyToolTip}">
<flowlauncher:HotkeyControl2
<flowlauncher:HotkeyControl2
DefaultHotkey="F1"
Hotkey="{Binding Settings.PreviewHotkey}"
ValidateKeyGesture="False"
WindowTitle="Preview hotkey" />
WindowTitle="{DynamicResource previewHotkey}" />
</cc:Card>
</StackPanel>