Skip to content

Commit 5707eae

Browse files
committed
- Add NumberBox
- Change Priority Popup to using Numberbox
1 parent 29fef1b commit 5707eae

File tree

3 files changed

+618
-31
lines changed

3 files changed

+618
-31
lines changed

Flow.Launcher/PriorityChangeWindow.xaml

Lines changed: 76 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,98 @@
1-
<Window x:Class="Flow.Launcher.PriorityChangeWindow"
2-
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5-
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6-
xmlns:local="clr-namespace:Flow.Launcher"
7-
Loaded="PriorityChangeWindow_Loaded"
8-
mc:Ignorable="d"
9-
ResizeMode="NoResize"
10-
WindowStartupLocation="CenterScreen"
11-
Title="{DynamicResource changePriorityWindow}" Height="365" Width="350" Background="#F3F3F3" BorderBrush="#cecece">
12-
<Grid>
1+
<Window
2+
x:Class="Flow.Launcher.PriorityChangeWindow"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Flow.Launcher"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:ui="http://schemas.modernwpf.com/2019"
9+
Title="{DynamicResource changePriorityWindow}"
10+
Background="#F3F3F3"
11+
BorderBrush="#cecece"
12+
Loaded="PriorityChangeWindow_Loaded"
13+
MouseDown="window_MouseDown"
14+
ResizeMode="NoResize"
15+
SizeToContent="WidthAndHeight"
16+
WindowStartupLocation="CenterScreen"
17+
mc:Ignorable="d">
18+
<Grid Width="350">
1319
<Grid.RowDefinitions>
1420
<RowDefinition />
15-
<RowDefinition Height="80"/>
21+
<RowDefinition Height="80" />
1622
</Grid.RowDefinitions>
17-
<Border BorderThickness="0 0 0 1" BorderBrush="#e5e5e5" Background="#ffffff" Padding="26 26 26 0">
23+
<Border
24+
Padding="26,26,26,0"
25+
Background="#ffffff"
26+
BorderBrush="#e5e5e5"
27+
BorderThickness="0,0,0,1">
1828
<Grid>
1929
<StackPanel>
20-
<StackPanel Grid.Row="0" Margin="0 0 0 12">
21-
<TextBlock Grid.Column="0" Text="{DynamicResource changePriorityWindow}" FontSize="20" FontWeight="SemiBold" FontFamily="Segoe UI" TextAlignment="Left"
22-
Margin="0 0 0 0" />
30+
<StackPanel Grid.Row="0" Margin="0,0,0,12">
31+
<TextBlock
32+
Grid.Column="0"
33+
Margin="0,0,0,0"
34+
FontFamily="Segoe UI"
35+
FontSize="20"
36+
FontWeight="SemiBold"
37+
Text="{DynamicResource changePriorityWindow}"
38+
TextAlignment="Left" />
2339
</StackPanel>
2440
<StackPanel>
25-
<TextBlock
26-
Text="{DynamicResource priority_tips}" Foreground="#1b1b1b" FontSize="14" TextWrapping="WrapWithOverflow" TextAlignment="Left"/>
41+
<TextBlock
42+
FontSize="14"
43+
Foreground="#1b1b1b"
44+
Text="{DynamicResource priority_tips}"
45+
TextAlignment="Left"
46+
TextWrapping="WrapWithOverflow" />
2747
</StackPanel>
28-
48+
49+
<!--
2950
<StackPanel Orientation="Horizontal" Margin="0 28 0 0">
3051
<TextBlock FontSize="14" Grid.Column="1" VerticalAlignment="Center"
3152
HorizontalAlignment="Left" Text="{DynamicResource currentPriority}" />
3253
<TextBlock x:Name="OldPriority" Grid.Row="0" Grid.Column="1" Margin="10 0 10 0" FontSize="14"
3354
VerticalAlignment="Center" HorizontalAlignment="Left" FontWeight="Bold" />
3455
</StackPanel>
56+
-->
3557

36-
<StackPanel Orientation="Horizontal" Margin="0 10 0 0">
37-
<TextBlock FontSize="14" VerticalAlignment="Center"
38-
HorizontalAlignment="Right" Text="{DynamicResource newPriority}" />
39-
<TextBox x:Name="tbAction" Margin="10 0 15 0" Width="105" VerticalAlignment="Center" HorizontalAlignment="Left" />
58+
<StackPanel Margin="0,18,0,18" Orientation="Horizontal">
59+
<TextBlock
60+
HorizontalAlignment="Right"
61+
VerticalAlignment="Center"
62+
FontSize="14"
63+
Text="{DynamicResource priority}" />
64+
<!--<TextBox x:Name="tbAction" Margin="10 0 15 0" Width="105" VerticalAlignment="Center" HorizontalAlignment="Left" />-->
65+
<ui:NumberBox
66+
x:Name="tbAction"
67+
Width="190"
68+
Height="34"
69+
Margin="10,0,15,0"
70+
HorizontalAlignment="Left"
71+
VerticalAlignment="Center"
72+
Minimum="0"
73+
SmallChange="1"
74+
SpinButtonPlacementMode="Inline" />
4075
</StackPanel>
4176
</StackPanel>
4277
</Grid>
4378
</Border>
44-
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Grid.Row="1">
45-
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="0 0 5 0" Width="100" Height="30"
46-
Content="{DynamicResource cancel}" />
47-
<Button x:Name="btnDone" Margin="5 0 0 0" Width="100" Height="30" Click="btnDone_OnClick">
79+
<StackPanel
80+
Grid.Row="1"
81+
HorizontalAlignment="Center"
82+
Orientation="Horizontal">
83+
<Button
84+
x:Name="btnCancel"
85+
Width="100"
86+
Height="30"
87+
Margin="0,0,5,0"
88+
Click="BtnCancel_OnClick"
89+
Content="{DynamicResource cancel}" />
90+
<Button
91+
x:Name="btnDone"
92+
Width="100"
93+
Height="30"
94+
Margin="5,0,0,0"
95+
Click="btnDone_OnClick">
4896
<TextBlock x:Name="lblAdd" Text="{DynamicResource done}" />
4997
</Button>
5098
</StackPanel>

Flow.Launcher/PriorityChangeWindow.xaml.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public partial class PriorityChangeWindow : Window
2626
private Settings settings;
2727
private readonly Internationalization translater = InternationalizationManager.Instance;
2828
private readonly PluginViewModel pluginViewModel;
29-
3029
public PriorityChangeWindow(string pluginId, Settings settings, PluginViewModel pluginViewModel)
3130
{
3231
InitializeComponent();
@@ -62,8 +61,18 @@ private void btnDone_OnClick(object sender, RoutedEventArgs e)
6261

6362
private void PriorityChangeWindow_Loaded(object sender, RoutedEventArgs e)
6463
{
65-
OldPriority.Text = pluginViewModel.Priority.ToString();
64+
tbAction.Text = pluginViewModel.Priority.ToString();
65+
//OldPriority.Text = pluginViewModel.Priority.ToString();
6666
tbAction.Focus();
6767
}
68+
private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */
69+
{
70+
TextBox textBox = Keyboard.FocusedElement as TextBox;
71+
if (textBox != null)
72+
{
73+
TraversalRequest tRequest = new TraversalRequest(FocusNavigationDirection.Next);
74+
textBox.MoveFocus(tRequest);
75+
}
76+
}
6877
}
6978
}

0 commit comments

Comments
 (0)