Skip to content

Commit add99c4

Browse files
committed
- Change MainwindowVisibility to using show()
- HotkeyMapper, CustomQueryHotkeySetting.
1 parent a2600af commit add99c4

File tree

3 files changed

+105
-35
lines changed

3 files changed

+105
-35
lines changed

Flow.Launcher/CustomQueryHotkeySetting.xaml

Lines changed: 103 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,126 @@
1-
<Window x:Class="Flow.Launcher.CustomQueryHotkeySetting"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
5-
Icon="Images\app.png"
6-
ResizeMode="NoResize"
7-
WindowStartupLocation="CenterScreen"
8-
MouseDown="window_MouseDown"
9-
Title="{DynamicResource customeQueryHotkeyTitle}" Height="345" Width="500" Background="#F3F3F3" BorderBrush="#cecece">
1+
<Window
2+
x:Class="Flow.Launcher.CustomQueryHotkeySetting"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:flowlauncher="clr-namespace:Flow.Launcher"
6+
Title="{DynamicResource customeQueryHotkeyTitle}"
7+
Width="500"
8+
Height="345"
9+
Background="#F3F3F3"
10+
BorderBrush="#cecece"
11+
Icon="Images\app.png"
12+
MouseDown="window_MouseDown"
13+
ResizeMode="NoResize"
14+
WindowStartupLocation="CenterScreen">
1015
<Window.InputBindings>
11-
<KeyBinding Key="Escape" Command="Close"/>
16+
<KeyBinding Key="Escape" Command="Close" />
1217
</Window.InputBindings>
1318
<Window.CommandBindings>
14-
<CommandBinding Command="Close" Executed="cmdEsc_OnPress"/>
19+
<CommandBinding Command="Close" Executed="cmdEsc_OnPress" />
1520
</Window.CommandBindings>
1621
<Grid>
1722
<Grid.RowDefinitions>
1823
<RowDefinition />
19-
<RowDefinition Height="80"/>
24+
<RowDefinition Height="80" />
2025
</Grid.RowDefinitions>
21-
<Border BorderThickness="0 0 0 1" BorderBrush="#e5e5e5" Background="#ffffff" Padding="26 26 26 0">
26+
<Border
27+
Padding="26,26,26,0"
28+
Background="#ffffff"
29+
BorderBrush="#e5e5e5"
30+
BorderThickness="0,0,0,1">
2231
<Grid>
2332
<StackPanel>
24-
<StackPanel Grid.Row="0" Margin="0 0 0 12">
25-
<TextBlock Grid.Column="0" Text="{DynamicResource customeQueryHotkeyTitle}" FontSize="20" FontWeight="SemiBold" FontFamily="Segoe UI" TextAlignment="Left"
26-
Margin="0 0 0 0" />
33+
<StackPanel Grid.Row="0" Margin="0,0,0,12">
34+
<TextBlock
35+
Grid.Column="0"
36+
Margin="0,0,0,0"
37+
FontFamily="Segoe UI"
38+
FontSize="20"
39+
FontWeight="SemiBold"
40+
Text="{DynamicResource customeQueryHotkeyTitle}"
41+
TextAlignment="Left" />
2742
</StackPanel>
2843
<StackPanel>
29-
<TextBlock
30-
Text="{DynamicResource customeQueryHotkeyTips}" Foreground="#1b1b1b" FontSize="14" TextWrapping="WrapWithOverflow" TextAlignment="Left"/>
44+
<TextBlock
45+
FontSize="14"
46+
Foreground="#1b1b1b"
47+
Text="{DynamicResource customeQueryHotkeyTips}"
48+
TextAlignment="Left"
49+
TextWrapping="WrapWithOverflow" />
3150
</StackPanel>
3251

33-
<StackPanel Orientation="Horizontal" Margin="0 20 0 0">
34-
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center"
35-
HorizontalAlignment="Left" Text="{DynamicResource hotkey}" Width="60"/>
36-
<flowlauncher:HotkeyControl x:Name="ctlHotkey" Margin="10,0,10,0" Grid.Column="1" VerticalAlignment="Center" Height="32" HorizontalAlignment="Left" HorizontalContentAlignment="Left" Width="200"/>
37-
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center"
38-
HorizontalAlignment="Left" Text="{DynamicResource actionKeyword}" />
52+
<StackPanel Margin="0,20,0,0" Orientation="Horizontal">
53+
<TextBlock
54+
Grid.Row="0"
55+
Grid.Column="0"
56+
Width="60"
57+
Margin="10"
58+
HorizontalAlignment="Left"
59+
VerticalAlignment="Center"
60+
FontSize="14"
61+
Text="{DynamicResource hotkey}" />
62+
<flowlauncher:HotkeyControl
63+
x:Name="ctlHotkey"
64+
Grid.Column="1"
65+
Width="200"
66+
Height="32"
67+
Margin="10,0,10,0"
68+
HorizontalAlignment="Left"
69+
VerticalAlignment="Center"
70+
HorizontalContentAlignment="Left" />
71+
<TextBlock
72+
Grid.Row="1"
73+
Grid.Column="0"
74+
Margin="10"
75+
HorizontalAlignment="Left"
76+
VerticalAlignment="Center"
77+
FontSize="14"
78+
Text="{DynamicResource actionKeyword}" />
3979
</StackPanel>
4080

41-
<StackPanel Orientation="Horizontal" Margin="0 0 0 0">
42-
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Width="60"
43-
HorizontalAlignment="Left" Text="{DynamicResource customQuery}" />
44-
<TextBox x:Name="tbAction" Margin="10" Width="250" VerticalAlignment="Center" HorizontalAlignment="Left" />
45-
<Button x:Name="btnTestActionKeyword" Padding="10 5 10 5" Height="30" Click="BtnTestActionKeyword_OnClick"
46-
Content="{DynamicResource preview}" />
81+
<StackPanel Margin="0,0,0,0" Orientation="Horizontal">
82+
<TextBlock
83+
Grid.Row="0"
84+
Grid.Column="0"
85+
Width="60"
86+
Margin="10"
87+
HorizontalAlignment="Left"
88+
VerticalAlignment="Center"
89+
FontSize="14"
90+
Text="{DynamicResource customQuery}" />
91+
<TextBox
92+
x:Name="tbAction"
93+
Width="250"
94+
Margin="10"
95+
HorizontalAlignment="Left"
96+
VerticalAlignment="Center" />
97+
<Button
98+
x:Name="btnTestActionKeyword"
99+
Height="30"
100+
Padding="10,5,10,5"
101+
Click="BtnTestActionKeyword_OnClick"
102+
Content="{DynamicResource preview}" />
47103
</StackPanel>
48104
</StackPanel>
49105
</Grid>
50106
</Border>
51-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
52-
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="10 0 5 0" Width="100" Height="32"
53-
Content="{DynamicResource cancel}" />
54-
<Button x:Name="btnAdd" Margin="5 0 10 0" Width="100" Height="32" Click="btnAdd_OnClick">
107+
<StackPanel
108+
Grid.Row="1"
109+
HorizontalAlignment="Center"
110+
Orientation="Horizontal">
111+
<Button
112+
x:Name="btnCancel"
113+
Width="100"
114+
Height="32"
115+
Margin="10,0,5,0"
116+
Click="BtnCancel_OnClick"
117+
Content="{DynamicResource cancel}" />
118+
<Button
119+
x:Name="btnAdd"
120+
Width="100"
121+
Height="32"
122+
Margin="5,0,10,0"
123+
Click="btnAdd_OnClick">
55124
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
56125
</Button>
57126
</StackPanel>

Flow.Launcher/CustomQueryHotkeySetting.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
9292
{
9393
App.API.ChangeQuery(tbAction.Text);
9494
Application.Current.MainWindow.Visibility = Visibility.Visible;
95+
Application.Current.MainWindow.Opacity = 1;
9596
Application.Current.MainWindow.Focus();
9697

9798
}

Flow.Launcher/Helper/HotKeyMapper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ internal static void SetCustomQueryHotkey(CustomPluginHotkey hotkey)
7878
if (mainViewModel.ShouldIgnoreHotkeys())
7979
return;
8080

81-
mainViewModel.MainWindowVisibility = Visibility.Visible;
81+
mainViewModel.Show();
8282
mainViewModel.ChangeQueryText(hotkey.ActionKeyword, true);
8383
});
8484
}

0 commit comments

Comments
 (0)