mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #2648 from Yusyuriv/new-hotkey-control
Improve Hotkey System
This commit is contained in:
commit
4ce591fa20
28 changed files with 2407 additions and 950 deletions
|
|
@ -6,7 +6,7 @@ using System.Windows.Input;
|
|||
|
||||
namespace Flow.Launcher.Infrastructure.Hotkey
|
||||
{
|
||||
public class HotkeyModel
|
||||
public record struct HotkeyModel
|
||||
{
|
||||
public bool Alt { get; set; }
|
||||
public bool Shift { get; set; }
|
||||
|
|
@ -17,8 +17,7 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
|
||||
private static readonly Dictionary<Key, string> specialSymbolDictionary = new Dictionary<Key, string>
|
||||
{
|
||||
{Key.Space, "Space"},
|
||||
{Key.Oem3, "~"}
|
||||
{ Key.Space, "Space" }, { Key.Oem3, "~" }
|
||||
};
|
||||
|
||||
public ModifierKeys ModifierKeys
|
||||
|
|
@ -30,18 +29,22 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
{
|
||||
modifierKeys |= ModifierKeys.Alt;
|
||||
}
|
||||
|
||||
if (Shift)
|
||||
{
|
||||
modifierKeys |= ModifierKeys.Shift;
|
||||
}
|
||||
|
||||
if (Win)
|
||||
{
|
||||
modifierKeys |= ModifierKeys.Windows;
|
||||
}
|
||||
|
||||
if (Ctrl)
|
||||
{
|
||||
modifierKeys |= ModifierKeys.Control;
|
||||
}
|
||||
|
||||
return modifierKeys;
|
||||
}
|
||||
}
|
||||
|
|
@ -66,31 +69,37 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
List<string> keys = hotkeyString.Replace(" ", "").Split('+').ToList();
|
||||
if (keys.Contains("Alt"))
|
||||
{
|
||||
Alt = true;
|
||||
keys.Remove("Alt");
|
||||
}
|
||||
|
||||
if (keys.Contains("Shift"))
|
||||
{
|
||||
Shift = true;
|
||||
keys.Remove("Shift");
|
||||
}
|
||||
|
||||
if (keys.Contains("Win"))
|
||||
{
|
||||
Win = true;
|
||||
keys.Remove("Win");
|
||||
}
|
||||
|
||||
if (keys.Contains("Ctrl"))
|
||||
{
|
||||
Ctrl = true;
|
||||
keys.Remove("Ctrl");
|
||||
}
|
||||
|
||||
if (keys.Count == 1)
|
||||
{
|
||||
string charKey = keys[0];
|
||||
KeyValuePair<Key, string>? specialSymbolPair = specialSymbolDictionary.FirstOrDefault(pair => pair.Value == charKey);
|
||||
KeyValuePair<Key, string>? specialSymbolPair =
|
||||
specialSymbolDictionary.FirstOrDefault(pair => pair.Value == charKey);
|
||||
if (specialSymbolPair.Value.Value != null)
|
||||
{
|
||||
CharKey = specialSymbolPair.Value.Key;
|
||||
|
|
@ -103,7 +112,6 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -111,33 +119,39 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
|
||||
public override string ToString()
|
||||
{
|
||||
List<string> keys = new List<string>();
|
||||
if (Ctrl)
|
||||
return string.Join(" + ", EnumerateDisplayKeys());
|
||||
}
|
||||
|
||||
public IEnumerable<string> EnumerateDisplayKeys()
|
||||
{
|
||||
if (Ctrl && CharKey is not (Key.LeftCtrl or Key.RightCtrl))
|
||||
{
|
||||
keys.Add("Ctrl");
|
||||
yield return "Ctrl";
|
||||
}
|
||||
if (Alt)
|
||||
|
||||
if (Alt && CharKey is not (Key.LeftAlt or Key.RightAlt))
|
||||
{
|
||||
keys.Add("Alt");
|
||||
yield return "Alt";
|
||||
}
|
||||
if (Shift)
|
||||
|
||||
if (Shift && CharKey is not (Key.LeftShift or Key.RightShift))
|
||||
{
|
||||
keys.Add("Shift");
|
||||
yield return "Shift";
|
||||
}
|
||||
if (Win)
|
||||
|
||||
if (Win && CharKey is not (Key.LWin or Key.RWin))
|
||||
{
|
||||
keys.Add("Win");
|
||||
yield return "Win";
|
||||
}
|
||||
|
||||
if (CharKey != Key.None)
|
||||
{
|
||||
keys.Add(specialSymbolDictionary.ContainsKey(CharKey)
|
||||
? specialSymbolDictionary[CharKey]
|
||||
: CharKey.ToString());
|
||||
yield return specialSymbolDictionary.TryGetValue(CharKey, out var value)
|
||||
? value
|
||||
: CharKey.ToString();
|
||||
}
|
||||
return string.Join(" + ", keys);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Validate hotkey
|
||||
/// </summary>
|
||||
|
|
@ -164,11 +178,13 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
{
|
||||
KeyGesture keyGesture = new KeyGesture(CharKey, ModifierKeys);
|
||||
}
|
||||
catch (System.Exception e) when (e is NotSupportedException || e is InvalidEnumArgumentException)
|
||||
catch (System.Exception e) when
|
||||
(e is NotSupportedException || e is InvalidEnumArgumentException)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (ModifierKeys == ModifierKeys.None)
|
||||
{
|
||||
return !IsPrintableCharacter(CharKey);
|
||||
|
|
@ -206,18 +222,6 @@ namespace Flow.Launcher.Infrastructure.Hotkey
|
|||
key == Key.Decimal;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (obj is HotkeyModel other)
|
||||
{
|
||||
return ModifierKeys == other.ModifierKeys && CharKey == other.CharKey;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(ModifierKeys, CharKey);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,16 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
public bool ShowOpenResultHotkey { get; set; } = true;
|
||||
public double WindowSize { get; set; } = 580;
|
||||
public string PreviewHotkey { get; set; } = $"F1";
|
||||
public string AutoCompleteHotkey { get; set; } = $"{KeyConstant.Ctrl} + Tab";
|
||||
public string AutoCompleteHotkey2 { get; set; } = $"";
|
||||
public string SelectNextItemHotkey { get; set; } = $"Tab";
|
||||
public string SelectNextItemHotkey2 { get; set; } = $"";
|
||||
public string SelectPrevItemHotkey { get; set; } = $"Shift + Tab";
|
||||
public string SelectPrevItemHotkey2 { get; set; } = $"";
|
||||
public string SelectNextPageHotkey { get; set; } = $"";
|
||||
public string SelectPrevPageHotkey { get; set; } = $"";
|
||||
public string OpenContextMenuHotkey { get; set; } = $"Ctrl+O";
|
||||
public string SettingWindowHotkey { get; set; } = $"Ctrl+I";
|
||||
|
||||
public string Language
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,10 +2,12 @@
|
|||
x:Class="Flow.Launcher.CustomQueryHotkeySetting"
|
||||
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:flowlauncher="clr-namespace:Flow.Launcher"
|
||||
Title="{DynamicResource customeQueryHotkeyTitle}"
|
||||
Width="530"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
Icon="Images\app.png"
|
||||
MouseDown="window_MouseDown"
|
||||
|
|
@ -60,94 +62,75 @@
|
|||
</Grid>
|
||||
</StackPanel>
|
||||
<StackPanel Margin="26,0,26,0">
|
||||
<StackPanel Grid.Row="0" Margin="0,0,0,12">
|
||||
<TextBlock
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,0"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource customeQueryHotkeyTitle}"
|
||||
TextAlignment="Left" />
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
Text="{DynamicResource customeQueryHotkeyTips}"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<Image
|
||||
Width="478"
|
||||
Margin="0,20,0,0"
|
||||
Source="/Images/illustration_01.png" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,0,0,12"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource customeQueryHotkeyTitle}"
|
||||
TextAlignment="Left" />
|
||||
<TextBlock
|
||||
FontSize="14"
|
||||
Text="{DynamicResource customeQueryHotkeyTips}"
|
||||
TextAlignment="Left"
|
||||
TextWrapping="WrapWithOverflow" />
|
||||
<Image
|
||||
Width="478"
|
||||
Margin="0,20,0,0"
|
||||
Source="/Images/illustration_01.png" />
|
||||
|
||||
<StackPanel Margin="0,20,0,0" Orientation="Horizontal">
|
||||
<Grid Width="478">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource hotkey}" />
|
||||
<StackPanel
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Orientation="Horizontal">
|
||||
<flowlauncher:HotkeyControl
|
||||
x:Name="ctlHotkey"
|
||||
Grid.Column="1"
|
||||
Width="200"
|
||||
Height="36"
|
||||
Margin="10,0,10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Left" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource actionKeyword}" />
|
||||
</StackPanel>
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource customQuery}" />
|
||||
<DockPanel
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
LastChildFill="True">
|
||||
<Button
|
||||
x:Name="btnTestActionKeyword"
|
||||
Margin="0,0,10,0"
|
||||
Padding="10,5,10,5"
|
||||
Click="BtnTestActionKeyword_OnClick"
|
||||
Content="{DynamicResource preview}"
|
||||
DockPanel.Dock="Right" />
|
||||
<TextBox
|
||||
x:Name="tbAction"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<Grid Width="478" Margin="0,20,0,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource hotkey}" />
|
||||
<flowlauncher:HotkeyControl
|
||||
x:Name="HotkeyControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="10,0,10,0"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalContentAlignment="Left"
|
||||
DefaultHotkey="" />
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Text="{DynamicResource customQuery}" />
|
||||
<TextBox
|
||||
x:Name="tbAction"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="10"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center" />
|
||||
<Button
|
||||
x:Name="btnTestActionKeyword"
|
||||
Grid.Row="1"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,10,0"
|
||||
Padding="10,5,10,5"
|
||||
Click="BtnTestActionKeyword_OnClick"
|
||||
Content="{DynamicResource preview}" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Border
|
||||
|
|
@ -174,4 +157,4 @@
|
|||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Controls;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -32,21 +33,11 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (!update)
|
||||
{
|
||||
if (!ctlHotkey.CurrentHotkeyAvailable)
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (_settings.CustomPluginHotkeys == null)
|
||||
{
|
||||
_settings.CustomPluginHotkeys = new ObservableCollection<CustomPluginHotkey>();
|
||||
}
|
||||
_settings.CustomPluginHotkeys ??= new ObservableCollection<CustomPluginHotkey>();
|
||||
|
||||
var pluginHotkey = new CustomPluginHotkey
|
||||
{
|
||||
Hotkey = ctlHotkey.CurrentHotkey.ToString(),
|
||||
ActionKeyword = tbAction.Text
|
||||
Hotkey = HotkeyControl.CurrentHotkey.ToString(), ActionKeyword = tbAction.Text
|
||||
};
|
||||
_settings.CustomPluginHotkeys.Add(pluginHotkey);
|
||||
|
||||
|
|
@ -54,14 +45,9 @@ namespace Flow.Launcher
|
|||
}
|
||||
else
|
||||
{
|
||||
if (updateCustomHotkey.Hotkey != ctlHotkey.CurrentHotkey.ToString() && !ctlHotkey.CurrentHotkeyAvailable)
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("hotkeyIsNotUnavailable"));
|
||||
return;
|
||||
}
|
||||
var oldHotkey = updateCustomHotkey.Hotkey;
|
||||
updateCustomHotkey.ActionKeyword = tbAction.Text;
|
||||
updateCustomHotkey.Hotkey = ctlHotkey.CurrentHotkey.ToString();
|
||||
updateCustomHotkey.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
//remove origin hotkey
|
||||
HotKeyMapper.RemoveHotkey(oldHotkey);
|
||||
HotKeyMapper.SetCustomQueryHotkey(updateCustomHotkey);
|
||||
|
|
@ -70,9 +56,11 @@ namespace Flow.Launcher
|
|||
Close();
|
||||
}
|
||||
|
||||
|
||||
public void UpdateItem(CustomPluginHotkey item)
|
||||
{
|
||||
updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o => o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
|
||||
updateCustomHotkey = _settings.CustomPluginHotkeys.FirstOrDefault(o =>
|
||||
o.ActionKeyword == item.ActionKeyword && o.Hotkey == item.Hotkey);
|
||||
if (updateCustomHotkey == null)
|
||||
{
|
||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPluginHotkey"));
|
||||
|
|
@ -81,7 +69,7 @@ namespace Flow.Launcher
|
|||
}
|
||||
|
||||
tbAction.Text = updateCustomHotkey.ActionKeyword;
|
||||
_ = ctlHotkey.SetHotkeyAsync(updateCustomHotkey.Hotkey, false);
|
||||
HotkeyControl.SetHotkey(updateCustomHotkey.Hotkey, false);
|
||||
update = true;
|
||||
lblAdd.Text = InternationalizationManager.Instance.GetTranslation("update");
|
||||
}
|
||||
|
|
@ -101,12 +89,10 @@ namespace Flow.Launcher
|
|||
|
||||
private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */
|
||||
{
|
||||
TextBox textBox = Keyboard.FocusedElement as TextBox;
|
||||
if (textBox != null)
|
||||
{
|
||||
TraversalRequest tRequest = new TraversalRequest(FocusNavigationDirection.Next);
|
||||
textBox.MoveFocus(tRequest);
|
||||
}
|
||||
if (Keyboard.FocusedElement is not TextBox textBox) return;
|
||||
|
||||
TraversalRequest tRequest = new TraversalRequest(FocusNavigationDirection.Next);
|
||||
textBox.MoveFocus(tRequest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,54 +3,75 @@
|
|||
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:input="clr-namespace:System.Windows.Input;assembly=PresentationCore"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Height="24"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="300"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Popup
|
||||
x:Name="popup"
|
||||
AllowDrop="True"
|
||||
AllowsTransparency="True"
|
||||
IsOpen="{Binding IsKeyboardFocused, ElementName=tbHotkey, Mode=OneWay}"
|
||||
Placement="Top"
|
||||
PlacementTarget="{Binding ElementName=tbHotkey}"
|
||||
PopupAnimation="Fade"
|
||||
StaysOpen="True"
|
||||
VerticalOffset="-5">
|
||||
<Border
|
||||
Width="140"
|
||||
Height="30"
|
||||
Background="{DynamicResource Color01B}"
|
||||
BorderBrush="{DynamicResource Color21B}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4">
|
||||
<TextBlock
|
||||
x:Name="tbMsg"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource flowlauncherPressHotkey}"
|
||||
Visibility="Visible" />
|
||||
</Border>
|
||||
</Popup>
|
||||
|
||||
<TextBox
|
||||
x:Name="tbHotkey"
|
||||
Margin="0,0,18,0"
|
||||
VerticalContentAlignment="Center"
|
||||
input:InputMethod.IsInputMethodEnabled="False"
|
||||
GotFocus="tbHotkey_GotFocus"
|
||||
LostFocus="tbHotkey_LostFocus"
|
||||
PreviewKeyDown="TbHotkey_OnPreviewKeyDown"
|
||||
TabIndex="100" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
<Button
|
||||
Width="Auto"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource Color01B}"
|
||||
Click="GetNewHotkey">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
x:Name="ButtonBorder"
|
||||
Padding="5,0,5,0"
|
||||
Background="{DynamicResource ButtonBackgroundColor}"
|
||||
BorderBrush="{DynamicResource ButtonInsideBorder}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
<Condition Property="IsPressed" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ButtonBorder" Property="Background"
|
||||
Value="{DynamicResource ButtonMousePressed}" />
|
||||
<Setter TargetName="ButtonBorder" Property="BorderBrush"
|
||||
Value="{DynamicResource ButtonMousePressedInsideBorder}" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsMouseOver" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ButtonBorder" Property="Background"
|
||||
Value="{DynamicResource ButtonMouseOver}" />
|
||||
</MultiTrigger>
|
||||
<MultiTrigger>
|
||||
<MultiTrigger.Conditions>
|
||||
<Condition Property="IsPressed" Value="True" />
|
||||
</MultiTrigger.Conditions>
|
||||
<Setter TargetName="ButtonBorder" Property="Background"
|
||||
Value="{DynamicResource ButtonMousePressed}" />
|
||||
<Setter TargetName="ButtonBorder" Property="BorderBrush"
|
||||
Value="{DynamicResource CustomContextHover}" />
|
||||
</MultiTrigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<Button.Content>
|
||||
<ItemsControl x:Name="HotkeyList">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
Margin="2,5,2,5"
|
||||
Padding="10,5,10,5"
|
||||
Background="{DynamicResource AccentButtonBackground}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<TextBlock Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</UserControl>
|
||||
|
|
|
|||
|
|
@ -1,141 +1,193 @@
|
|||
using System;
|
||||
#nullable enable
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Plugin;
|
||||
using System.Threading;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
public partial class HotkeyControl : UserControl
|
||||
public partial class HotkeyControl
|
||||
{
|
||||
public HotkeyModel CurrentHotkey { get; private set; }
|
||||
public bool CurrentHotkeyAvailable { get; private set; }
|
||||
public string WindowTitle {
|
||||
get { return (string)GetValue(WindowTitleProperty); }
|
||||
set { SetValue(WindowTitleProperty, value); }
|
||||
}
|
||||
|
||||
public event EventHandler HotkeyChanged;
|
||||
public static readonly DependencyProperty WindowTitleProperty = DependencyProperty.Register(
|
||||
nameof(WindowTitle),
|
||||
typeof(string),
|
||||
typeof(HotkeyControl),
|
||||
new PropertyMetadata(string.Empty)
|
||||
);
|
||||
|
||||
/// <summary>
|
||||
/// Designed for Preview Hotkey and KeyGesture.
|
||||
/// </summary>
|
||||
public bool ValidateKeyGesture { get; set; } = false;
|
||||
public static readonly DependencyProperty ValidateKeyGestureProperty = DependencyProperty.Register(
|
||||
nameof(ValidateKeyGesture),
|
||||
typeof(bool),
|
||||
typeof(HotkeyControl),
|
||||
new PropertyMetadata(default(bool))
|
||||
);
|
||||
|
||||
protected virtual void OnHotkeyChanged() => HotkeyChanged?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
public HotkeyControl()
|
||||
public bool ValidateKeyGesture
|
||||
{
|
||||
InitializeComponent();
|
||||
get { return (bool)GetValue(ValidateKeyGestureProperty); }
|
||||
set { SetValue(ValidateKeyGestureProperty, value); }
|
||||
}
|
||||
|
||||
private CancellationTokenSource hotkeyUpdateSource;
|
||||
public static readonly DependencyProperty DefaultHotkeyProperty = DependencyProperty.Register(
|
||||
nameof(DefaultHotkey),
|
||||
typeof(string),
|
||||
typeof(HotkeyControl),
|
||||
new PropertyMetadata(default(string))
|
||||
);
|
||||
|
||||
private void TbHotkey_OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
public string DefaultHotkey
|
||||
{
|
||||
hotkeyUpdateSource?.Cancel();
|
||||
hotkeyUpdateSource?.Dispose();
|
||||
hotkeyUpdateSource = new();
|
||||
var token = hotkeyUpdateSource.Token;
|
||||
e.Handled = true;
|
||||
get { return (string)GetValue(DefaultHotkeyProperty); }
|
||||
set { SetValue(DefaultHotkeyProperty, value); }
|
||||
}
|
||||
|
||||
//when alt is pressed, the real key should be e.SystemKey
|
||||
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
|
||||
|
||||
SpecialKeyState specialKeyState = GlobalHotkey.CheckModifiers();
|
||||
|
||||
var hotkeyModel = new HotkeyModel(
|
||||
specialKeyState.AltPressed,
|
||||
specialKeyState.ShiftPressed,
|
||||
specialKeyState.WinPressed,
|
||||
specialKeyState.CtrlPressed,
|
||||
key);
|
||||
|
||||
if (hotkeyModel.Equals(CurrentHotkey))
|
||||
private static void OnHotkeyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
if (d is not HotkeyControl hotkeyControl)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_ = Dispatcher.InvokeAsync(async () =>
|
||||
{
|
||||
await Task.Delay(500, token);
|
||||
if (!token.IsCancellationRequested)
|
||||
await SetHotkeyAsync(hotkeyModel);
|
||||
});
|
||||
hotkeyControl.SetKeysToDisplay(new HotkeyModel(hotkeyControl.Hotkey));
|
||||
hotkeyControl.CurrentHotkey = new HotkeyModel(hotkeyControl.Hotkey);
|
||||
}
|
||||
|
||||
public async Task SetHotkeyAsync(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
{
|
||||
tbHotkey.Text = keyModel.ToString();
|
||||
tbHotkey.Select(tbHotkey.Text.Length, 0);
|
||||
|
||||
public static readonly DependencyProperty ChangeHotkeyProperty = DependencyProperty.Register(
|
||||
nameof(ChangeHotkey),
|
||||
typeof(ICommand),
|
||||
typeof(HotkeyControl),
|
||||
new PropertyMetadata(default(ICommand))
|
||||
);
|
||||
|
||||
public ICommand? ChangeHotkey
|
||||
{
|
||||
get { return (ICommand)GetValue(ChangeHotkeyProperty); }
|
||||
set { SetValue(ChangeHotkeyProperty, value); }
|
||||
}
|
||||
|
||||
|
||||
public static readonly DependencyProperty HotkeyProperty = DependencyProperty.Register(
|
||||
nameof(Hotkey),
|
||||
typeof(string),
|
||||
typeof(HotkeyControl),
|
||||
new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnHotkeyChanged)
|
||||
);
|
||||
|
||||
public string Hotkey
|
||||
{
|
||||
get { return (string)GetValue(HotkeyProperty); }
|
||||
set { SetValue(HotkeyProperty, value); }
|
||||
}
|
||||
|
||||
public HotkeyControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
HotkeyList.ItemsSource = KeysToDisplay;
|
||||
SetKeysToDisplay(CurrentHotkey);
|
||||
}
|
||||
|
||||
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) =>
|
||||
hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
|
||||
|
||||
public string EmptyHotkey => InternationalizationManager.Instance.GetTranslation("none");
|
||||
|
||||
public ObservableCollection<string> KeysToDisplay { get; set; } = new();
|
||||
|
||||
public HotkeyModel CurrentHotkey { get; private set; } = new(false, false, false, false, Key.None);
|
||||
|
||||
|
||||
public void GetNewHotkey(object sender, RoutedEventArgs e)
|
||||
{
|
||||
OpenHotkeyDialog();
|
||||
}
|
||||
|
||||
private async Task OpenHotkeyDialog()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(Hotkey))
|
||||
{
|
||||
HotKeyMapper.RemoveHotkey(Hotkey);
|
||||
}
|
||||
|
||||
var dialog = new HotkeyControlDialog(Hotkey, DefaultHotkey, WindowTitle);
|
||||
await dialog.ShowAsync();
|
||||
switch (dialog.ResultType)
|
||||
{
|
||||
case HotkeyControlDialog.EResultType.Cancel:
|
||||
SetHotkey(Hotkey);
|
||||
return;
|
||||
case HotkeyControlDialog.EResultType.Save:
|
||||
SetHotkey(dialog.ResultValue);
|
||||
break;
|
||||
case HotkeyControlDialog.EResultType.Delete:
|
||||
Delete();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetHotkey(HotkeyModel keyModel, bool triggerValidate = true)
|
||||
{
|
||||
if (triggerValidate)
|
||||
{
|
||||
bool hotkeyAvailable = CheckHotkeyAvailability(keyModel, ValidateKeyGesture);
|
||||
CurrentHotkeyAvailable = hotkeyAvailable;
|
||||
SetMessage(hotkeyAvailable);
|
||||
OnHotkeyChanged();
|
||||
|
||||
var token = hotkeyUpdateSource.Token;
|
||||
await Task.Delay(500, token);
|
||||
if (token.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
if (CurrentHotkeyAvailable)
|
||||
if (!hotkeyAvailable)
|
||||
{
|
||||
CurrentHotkey = keyModel;
|
||||
// To trigger LostFocus
|
||||
FocusManager.SetFocusedElement(FocusManager.GetFocusScope(this), null);
|
||||
Keyboard.ClearFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
Hotkey = keyModel.ToString();
|
||||
SetKeysToDisplay(CurrentHotkey);
|
||||
ChangeHotkey?.Execute(keyModel);
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentHotkey = keyModel;
|
||||
Hotkey = keyModel.ToString();
|
||||
ChangeHotkey?.Execute(keyModel);
|
||||
}
|
||||
}
|
||||
|
||||
public Task SetHotkeyAsync(string keyStr, bool triggerValidate = true)
|
||||
|
||||
public void Delete()
|
||||
{
|
||||
return SetHotkeyAsync(new HotkeyModel(keyStr), triggerValidate);
|
||||
if (!string.IsNullOrEmpty(Hotkey))
|
||||
HotKeyMapper.RemoveHotkey(Hotkey);
|
||||
Hotkey = "";
|
||||
SetKeysToDisplay(new HotkeyModel(false, false, false, false, Key.None));
|
||||
}
|
||||
|
||||
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) => hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
|
||||
|
||||
public new bool IsFocused => tbHotkey.IsFocused;
|
||||
|
||||
private void tbHotkey_LostFocus(object sender, RoutedEventArgs e)
|
||||
private void SetKeysToDisplay(HotkeyModel? hotkey)
|
||||
{
|
||||
tbHotkey.Text = CurrentHotkey?.ToString() ?? "";
|
||||
tbHotkey.Select(tbHotkey.Text.Length, 0);
|
||||
}
|
||||
KeysToDisplay.Clear();
|
||||
|
||||
private void tbHotkey_GotFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ResetMessage();
|
||||
}
|
||||
|
||||
private void ResetMessage()
|
||||
{
|
||||
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("flowlauncherPressHotkey");
|
||||
tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B");
|
||||
}
|
||||
|
||||
private void SetMessage(bool hotkeyAvailable)
|
||||
{
|
||||
if (!hotkeyAvailable)
|
||||
if (hotkey == null || hotkey == default(HotkeyModel))
|
||||
{
|
||||
tbMsg.Foreground = new SolidColorBrush(Colors.Red);
|
||||
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable");
|
||||
KeysToDisplay.Add(EmptyHotkey);
|
||||
return;
|
||||
}
|
||||
else
|
||||
|
||||
foreach (var key in hotkey.Value.EnumerateDisplayKeys()!)
|
||||
{
|
||||
tbMsg.Foreground = new SolidColorBrush(Colors.Green);
|
||||
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("success");
|
||||
KeysToDisplay.Add(key);
|
||||
}
|
||||
tbMsg.Visibility = Visibility.Visible;
|
||||
}
|
||||
|
||||
public void SetHotkey(string? keyStr, bool triggerValidate = true)
|
||||
{
|
||||
SetHotkey(new HotkeyModel(keyStr), triggerValidate);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
153
Flow.Launcher/HotkeyControlDialog.xaml
Normal file
153
Flow.Launcher/HotkeyControlDialog.xaml
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
<ui:ContentDialog
|
||||
x:Class="Flow.Launcher.HotkeyControlDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
||||
BorderThickness="0,1,0,0"
|
||||
CornerRadius="8"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
PreviewKeyDown="OnPreviewKeyDown"
|
||||
Style="{DynamicResource ContentDialog}">
|
||||
<ui:ContentDialog.Resources>
|
||||
<Thickness x:Key="ContentDialogPadding">0</Thickness>
|
||||
<Thickness x:Key="ContentDialogTitleMargin">0</Thickness>
|
||||
</ui:ContentDialog.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="100" />
|
||||
<RowDefinition Height="80" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Window title and the keys in the hotkey -->
|
||||
<Grid Grid.Row="0" Margin="26,12,26,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel>
|
||||
<TextBlock
|
||||
Margin="0,0,0,0"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{Binding WindowTitle}"
|
||||
TextAlignment="Left" />
|
||||
<TextBlock FontSize="14" Text="{DynamicResource hotkeyRegGuide}" />
|
||||
</StackPanel>
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Width="450"
|
||||
Height="100"
|
||||
Margin="0,100,0,0"
|
||||
Padding="26,12,26,0">
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<ItemsControl ItemsSource="{Binding KeysToDisplay}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border
|
||||
MinWidth="50"
|
||||
MinHeight="50"
|
||||
Margin="5,0,5,0"
|
||||
Padding="8"
|
||||
Background="{DynamicResource AccentButtonBackground}"
|
||||
CornerRadius="6">
|
||||
<TextBlock
|
||||
Margin="5,0,5,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="18"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource Color01B}"
|
||||
Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<!-- Warning message for when something went wrong with the new hotkey. -->
|
||||
<Border Grid.Row="1">
|
||||
|
||||
<Border
|
||||
x:Name="Alert"
|
||||
Width="420"
|
||||
Height="50"
|
||||
HorizontalAlignment="Center"
|
||||
Background="{DynamicResource InfoBarWarningBG}"
|
||||
BorderBrush="{DynamicResource InfoBarBD}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5"
|
||||
Visibility="Collapsed">
|
||||
<Grid VerticalAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:FontIcon
|
||||
Margin="20,0,14,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="15"
|
||||
Foreground="{DynamicResource InfoBarWarningIcon}"
|
||||
Glyph="" />
|
||||
<TextBlock
|
||||
x:Name="tbMsg"
|
||||
Margin="0,0,0,2"
|
||||
HorizontalAlignment="Left"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource Color05B}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
</Border>
|
||||
|
||||
<!-- Action buttons at the bottom of the dialog -->
|
||||
<Border
|
||||
Grid.Row="2"
|
||||
Background="{DynamicResource PopupButtonAreaBGColor}"
|
||||
BorderBrush="{DynamicResource PopupButtonAreaBorderColor}"
|
||||
BorderThickness="0,1,0,0"
|
||||
CornerRadius="0 0 8 8">
|
||||
<StackPanel
|
||||
Margin="10"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
x:Name="SaveBtn"
|
||||
Height="30"
|
||||
MinWidth="100"
|
||||
Margin="0,0,4,0"
|
||||
Click="Save"
|
||||
Content="{DynamicResource commonSave}"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
<Button
|
||||
Height="30"
|
||||
MinWidth="100"
|
||||
Margin="4,0,4,0"
|
||||
Click="Reset"
|
||||
Content="{DynamicResource commonReset}" />
|
||||
<Button
|
||||
Height="30"
|
||||
MinWidth="100"
|
||||
Margin="4,0,4,0"
|
||||
Click="Delete"
|
||||
Content="{DynamicResource commonDelete}" />
|
||||
<Button
|
||||
Height="30"
|
||||
MinWidth="100"
|
||||
Margin="4,0,0,0"
|
||||
Click="Cancel"
|
||||
Content="{DynamicResource commonCancel}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</ui:ContentDialog>
|
||||
127
Flow.Launcher/HotkeyControlDialog.xaml.cs
Normal file
127
Flow.Launcher/HotkeyControlDialog.xaml.cs
Normal file
|
|
@ -0,0 +1,127 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Flow.Launcher.Core.Resource;
|
||||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
using Flow.Launcher.Plugin;
|
||||
using ModernWpf.Controls;
|
||||
|
||||
namespace Flow.Launcher;
|
||||
|
||||
public partial class HotkeyControlDialog : ContentDialog
|
||||
{
|
||||
private string DefaultHotkey { get; }
|
||||
public string WindowTitle { get; }
|
||||
public HotkeyModel CurrentHotkey { get; private set; }
|
||||
public ObservableCollection<string> KeysToDisplay { get; } = new();
|
||||
|
||||
public enum EResultType
|
||||
{
|
||||
Cancel,
|
||||
Save,
|
||||
Delete
|
||||
}
|
||||
|
||||
public EResultType ResultType { get; private set; } = EResultType.Cancel;
|
||||
public string ResultValue { get; private set; } = string.Empty;
|
||||
public static string EmptyHotkey => InternationalizationManager.Instance.GetTranslation("none");
|
||||
|
||||
public HotkeyControlDialog(string hotkey, string defaultHotkey, string windowTitle = "")
|
||||
{
|
||||
WindowTitle = windowTitle switch
|
||||
{
|
||||
"" or null => InternationalizationManager.Instance.GetTranslation("hotkeyRegTitle"),
|
||||
_ => windowTitle
|
||||
};
|
||||
DefaultHotkey = defaultHotkey;
|
||||
CurrentHotkey = new HotkeyModel(hotkey);
|
||||
SetKeysToDisplay(CurrentHotkey);
|
||||
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Reset(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
SetKeysToDisplay(new HotkeyModel(DefaultHotkey));
|
||||
}
|
||||
|
||||
private void Delete(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
KeysToDisplay.Clear();
|
||||
KeysToDisplay.Add(EmptyHotkey);
|
||||
}
|
||||
|
||||
private void Cancel(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
ResultType = EResultType.Cancel;
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void Save(object sender, RoutedEventArgs routedEventArgs)
|
||||
{
|
||||
if (KeysToDisplay.Count == 1 && KeysToDisplay[0] == EmptyHotkey)
|
||||
{
|
||||
ResultType = EResultType.Delete;
|
||||
Hide();
|
||||
return;
|
||||
}
|
||||
ResultType = EResultType.Save;
|
||||
ResultValue = string.Join("+", KeysToDisplay);
|
||||
Hide();
|
||||
}
|
||||
|
||||
private void OnPreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
//when alt is pressed, the real key should be e.SystemKey
|
||||
Key key = e.Key == Key.System ? e.SystemKey : e.Key;
|
||||
|
||||
SpecialKeyState specialKeyState = GlobalHotkey.CheckModifiers();
|
||||
|
||||
var hotkeyModel = new HotkeyModel(
|
||||
specialKeyState.AltPressed,
|
||||
specialKeyState.ShiftPressed,
|
||||
specialKeyState.WinPressed,
|
||||
specialKeyState.CtrlPressed,
|
||||
key);
|
||||
|
||||
CurrentHotkey = hotkeyModel;
|
||||
SetKeysToDisplay(CurrentHotkey);
|
||||
}
|
||||
|
||||
private void SetKeysToDisplay(HotkeyModel? hotkey)
|
||||
{
|
||||
KeysToDisplay.Clear();
|
||||
|
||||
if (hotkey == null || hotkey == default(HotkeyModel))
|
||||
{
|
||||
KeysToDisplay.Add(EmptyHotkey);
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var key in hotkey.Value.EnumerateDisplayKeys()!)
|
||||
{
|
||||
KeysToDisplay.Add(key);
|
||||
}
|
||||
|
||||
if (tbMsg == null)
|
||||
return;
|
||||
|
||||
if (!CheckHotkeyAvailability(hotkey.Value, true))
|
||||
{
|
||||
tbMsg.Text = InternationalizationManager.Instance.GetTranslation("hotkeyUnavailable");
|
||||
Alert.Visibility = Visibility.Visible;
|
||||
SaveBtn.IsEnabled = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.Visibility = Visibility.Collapsed;
|
||||
SaveBtn.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static bool CheckHotkeyAvailability(HotkeyModel hotkey, bool validateKeyGesture) =>
|
||||
hotkey.Validate(validateKeyGesture) && HotKeyMapper.CheckAvailability(hotkey);
|
||||
}
|
||||
|
|
@ -172,14 +172,34 @@
|
|||
<!-- Setting Hotkey -->
|
||||
<system:String x:Key="hotkey">Hotkey</system:String>
|
||||
<system:String x:Key="hotkeys">Hotkeys</system:String>
|
||||
<system:String x:Key="flowlauncherHotkey">Flow Launcher Hotkey</system:String>
|
||||
<system:String x:Key="flowlauncherHotkey">Open Flow Launcher</system:String>
|
||||
<system:String x:Key="flowlauncherHotkeyToolTip">Enter shortcut to show/hide Flow Launcher.</system:String>
|
||||
<system:String x:Key="previewHotkey">Preview Hotkey</system:String>
|
||||
<system:String x:Key="previewHotkey">Toggle Preview</system:String>
|
||||
<system:String x:Key="previewHotkeyToolTip">Enter shortcut to show/hide preview in search window.</system:String>
|
||||
<system:String x:Key="hotkeyPresets">Hotkey Presets</system:String>
|
||||
<system:String x:Key="hotkeyPresetsToolTip">List of currently registered hotkeys</system:String>
|
||||
<system:String x:Key="openResultModifiers">Open Result Modifier Key</system:String>
|
||||
<system:String x:Key="openResultModifiersToolTip">Select a modifier key to open selected result via keyboard.</system:String>
|
||||
<system:String x:Key="showOpenResultHotkey">Show Hotkey</system:String>
|
||||
<system:String x:Key="showOpenResultHotkeyToolTip">Show result selection hotkey with results.</system:String>
|
||||
<system:String x:Key="autoCompleteHotkey">Auto Complete</system:String>
|
||||
<system:String x:Key="autoCompleteHotkeyToolTip">Runs autocomplete for the selected items.</system:String>
|
||||
<system:String x:Key="SelectNextItemHotkey">Select Next Item</system:String>
|
||||
<system:String x:Key="SelectPrevItemHotkey">Select Prev Item</system:String>
|
||||
<system:String x:Key="SelectNextPageHotkey">Next Page</system:String>
|
||||
<system:String x:Key="SelectPrevPageHotkey">Prev Page</system:String>
|
||||
<system:String x:Key="OpenContextMenuHotkey">Open Context Menu</system:String>
|
||||
<system:String x:Key="SettingWindowHotkey">Open Setting Window</system:String>
|
||||
<system:String x:Key="CopyFilePathHotkey">Copy File Path</system:String>
|
||||
<system:String x:Key="ToggleGameModeHotkey">Toggle Game Mode</system:String>
|
||||
<system:String x:Key="ToggleHistoryHotkey">Toggle History</system:String>
|
||||
<system:String x:Key="OpenContainFolderHotkey">Open Containing Folder</system:String>
|
||||
<system:String x:Key="RunAsAdminHotkey">Run As Admin</system:String>
|
||||
<system:String x:Key="ReloadPluginHotkey">Reload Plugins Data</system:String>
|
||||
<system:String x:Key="QuickWidthHotkey">Quick Adjust Window Width Size</system:String>
|
||||
<system:String x:Key="QuickHeightHotkey">Quick Adjust Window Height Size</system:String>
|
||||
<system:String x:Key="ReloadPluginHotkeyToolTip">Use when require plugins to reload and update their existing data.</system:String>
|
||||
<system:String x:Key="AdditionalHotkeyToolTip">You can add one more hotkey for this function.</system:String>
|
||||
<system:String x:Key="customQueryHotkey">Custom Query Hotkeys</system:String>
|
||||
<system:String x:Key="customQueryShortcut">Custom Query Shortcuts</system:String>
|
||||
<system:String x:Key="builtinShortcuts">Built-in Shortcuts</system:String>
|
||||
|
|
@ -190,6 +210,7 @@
|
|||
<system:String x:Key="delete">Delete</system:String>
|
||||
<system:String x:Key="edit">Edit</system:String>
|
||||
<system:String x:Key="add">Add</system:String>
|
||||
<system:String x:Key="none">None</system:String>
|
||||
<system:String x:Key="pleaseSelectAnItem">Please select an item</system:String>
|
||||
<system:String x:Key="deleteCustomHotkeyWarning">Are you sure you want to delete {0} plugin hotkey?</system:String>
|
||||
<system:String x:Key="deleteCustomShortcutWarning">Are you sure you want to delete shortcut: {0} with expansion {1}?</system:String>
|
||||
|
|
@ -288,6 +309,9 @@
|
|||
<system:String x:Key="hotkeyIsNotUnavailable">Hotkey is unavailable, please select a new hotkey</system:String>
|
||||
<system:String x:Key="invalidPluginHotkey">Invalid plugin hotkey</system:String>
|
||||
<system:String x:Key="update">Update</system:String>
|
||||
<system:String x:Key="hotkeyRegTitle">Binding Hotkey</system:String>
|
||||
<system:String x:Key="hotkeyUnavailable">Current hotkey is unavailable.</system:String>
|
||||
<system:String x:Key="hotkeyRegGuide">Press the keys you want to use for this function.</system:String>
|
||||
|
||||
<!-- Custom Query Shortcut Dialog -->
|
||||
<system:String x:Key="customeQueryShortcutTitle">Custom Query Shortcut</system:String>
|
||||
|
|
@ -297,8 +321,11 @@
|
|||
<system:String x:Key="duplicateShortcut">Shortcut already exists, please enter a new Shortcut or edit the existing one.</system:String>
|
||||
<system:String x:Key="emptyShortcut">Shortcut and/or its expansion is empty.</system:String>
|
||||
|
||||
<!-- Hotkey Control -->
|
||||
<system:String x:Key="hotkeyUnavailable">Hotkey Unavailable</system:String>
|
||||
<!-- Common Action -->
|
||||
<system:String x:Key="commonSave">Save</system:String>
|
||||
<system:String x:Key="commonCancel">Cancel</system:String>
|
||||
<system:String x:Key="commonReset">Reset</system:String>
|
||||
<system:String x:Key="commonDelete">Delete</system:String>
|
||||
|
||||
<!-- Crash Reporter -->
|
||||
<system:String x:Key="reportWindow_version">Version</system:String>
|
||||
|
|
|
|||
|
|
@ -46,47 +46,14 @@
|
|||
<Window.InputBindings>
|
||||
<KeyBinding Key="Escape" Command="{Binding EscCommand}" />
|
||||
<KeyBinding Key="F5" Command="{Binding ReloadPluginDataCommand}" />
|
||||
<KeyBinding Key="Tab" Command="{Binding AutocompleteQueryCommand}" />
|
||||
<KeyBinding
|
||||
Key="Tab"
|
||||
Command="{Binding AutocompleteQueryCommand}"
|
||||
Modifiers="Shift" />
|
||||
<KeyBinding
|
||||
Key="I"
|
||||
Command="{Binding OpenSettingCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="N"
|
||||
Command="{Binding SelectNextItemCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="J"
|
||||
Command="{Binding SelectNextItemCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="D"
|
||||
Command="{Binding SelectNextPageCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="P"
|
||||
Command="{Binding SelectPrevItemCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="K"
|
||||
Command="{Binding SelectPrevItemCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="U"
|
||||
Command="{Binding SelectPrevPageCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="Home"
|
||||
Command="{Binding SelectFirstResultCommand}"
|
||||
Modifiers="Alt" />
|
||||
<KeyBinding
|
||||
Key="O"
|
||||
Command="{Binding LoadContextMenuCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
Key="End"
|
||||
Command="{Binding SelectLastResultCommand}"
|
||||
Modifiers="Alt" />
|
||||
<KeyBinding
|
||||
Key="R"
|
||||
Command="{Binding ReQueryCommand}"
|
||||
|
|
@ -111,10 +78,6 @@
|
|||
Key="OemMinus"
|
||||
Command="{Binding DecreaseMaxResultCommand}"
|
||||
Modifiers="Control" />
|
||||
<KeyBinding
|
||||
Key="H"
|
||||
Command="{Binding LoadHistoryCommand}"
|
||||
Modifiers="Ctrl" />
|
||||
<KeyBinding
|
||||
Key="Enter"
|
||||
Command="{Binding OpenResultCommand}"
|
||||
|
|
@ -194,6 +157,46 @@
|
|||
Key="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding TogglePreviewCommand}"
|
||||
Modifiers="{Binding PreviewHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding AutocompleteQueryCommand}"
|
||||
Modifiers="{Binding AutoCompleteHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding AutoCompleteHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding AutocompleteQueryCommand}"
|
||||
Modifiers="{Binding AutoCompleteHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectNextItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectNextItemCommand}"
|
||||
Modifiers="{Binding SelectNextItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectPrevItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectPrevItemCommand}"
|
||||
Modifiers="{Binding SelectPrevItemHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectNextItemHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectNextItemCommand}"
|
||||
Modifiers="{Binding SelectNextItemHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectPrevItemHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectPrevItemCommand}"
|
||||
Modifiers="{Binding SelectPrevItemHotkey2, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding OpenSettingCommand}"
|
||||
Modifiers="{Binding SettingWindowHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding OpenContextMenuHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding LoadContextMenuCommand}"
|
||||
Modifiers="{Binding OpenContextMenuHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectNextPageHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectNextPageCommand}"
|
||||
Modifiers="{Binding SelectNextPageHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
<KeyBinding
|
||||
Key="{Binding SelectPrevPageHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='key'}"
|
||||
Command="{Binding SelectPrevPageCommand}"
|
||||
Modifiers="{Binding SelectPrevPageHotkey, Converter={StaticResource StringToKeyBindingConverter}, ConverterParameter='modifiers'}" />
|
||||
</Window.InputBindings>
|
||||
<Grid>
|
||||
<Border MouseDown="OnMouseDown" Style="{DynamicResource WindowBorderStyle}">
|
||||
|
|
|
|||
117
Flow.Launcher/Resources/Controls/Card.xaml
Normal file
117
Flow.Launcher/Resources/Controls/Card.xaml
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
<UserControl
|
||||
x:Class="Flow.Launcher.Resources.Controls.Card"
|
||||
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.Resources.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Template>
|
||||
<ControlTemplate TargetType="UserControl">
|
||||
<Border x:Name="BD" HorizontalAlignment="Stretch">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="Background" Value="{DynamicResource Color00B}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Color03B}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="5" />
|
||||
<Setter Property="MinHeight" Value="68" />
|
||||
<Setter Property="Margin" Value="0,4,0,0" />
|
||||
<Setter Property="SnapsToDevicePixels" Value="True" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:Card}}" Value="Inside">
|
||||
<Setter Property="BorderThickness" Value="0,1,0,0" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:Card}}" Value="InsideFit">
|
||||
<Setter Property="BorderThickness" Value="0,1,0,0" />
|
||||
<Setter Property="CornerRadius" Value="0" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Padding" Value="38,0,26,0" />
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition
|
||||
Width="auto"
|
||||
MinWidth="20"
|
||||
MaxWidth="60" />
|
||||
<ColumnDefinition Width="8*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentControl
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,16,0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}" />
|
||||
<StackPanel>
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Width" Value="Auto" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<TextBlock x:Name="ItemTitle" Text="{Binding Title, RelativeSource={RelativeSource AncestorType=local:Card}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="SubTitle" Text="{Binding Sub, RelativeSource={RelativeSource AncestorType=local:Card}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=SubTitle, Path=Text}" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color04B}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Padding" Value="0,0,24,0" />
|
||||
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock x:Name="ItemIcon" Text="{Binding Icon, RelativeSource={RelativeSource AncestorType=local:Card}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ItemIcon, Path=Text}" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Margin" Value="24,0,0,0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Margin" Value="24,0,16,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<Setter Property="FontFamily" Value="/Resources/#Segoe Fluent Icons" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</Grid>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</UserControl.Template>
|
||||
</UserControl>
|
||||
63
Flow.Launcher/Resources/Controls/Card.xaml.cs
Normal file
63
Flow.Launcher/Resources/Controls/Card.xaml.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System.Windows;
|
||||
using UserControl = System.Windows.Controls.UserControl;
|
||||
|
||||
namespace Flow.Launcher.Resources.Controls
|
||||
{
|
||||
public partial class Card : UserControl
|
||||
{
|
||||
public enum CardType
|
||||
{
|
||||
Default,
|
||||
Inside,
|
||||
InsideFit
|
||||
}
|
||||
|
||||
public Card()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public string Title
|
||||
{
|
||||
get { return (string)GetValue(TitleProperty); }
|
||||
set { SetValue(TitleProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty TitleProperty =
|
||||
DependencyProperty.Register(nameof(Title), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string Sub
|
||||
{
|
||||
get { return (string)GetValue(SubProperty); }
|
||||
set { SetValue(SubProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SubProperty =
|
||||
DependencyProperty.Register(nameof(Sub), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string Icon
|
||||
{
|
||||
get { return (string)GetValue(IconProperty); }
|
||||
set { SetValue(IconProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IconProperty =
|
||||
DependencyProperty.Register(nameof(Icon), typeof(string), typeof(Card), new PropertyMetadata(string.Empty));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional content for the UserControl
|
||||
/// </summary>
|
||||
public object AdditionalContent
|
||||
{
|
||||
get { return (object)GetValue(AdditionalContentProperty); }
|
||||
set { SetValue(AdditionalContentProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty AdditionalContentProperty =
|
||||
DependencyProperty.Register(nameof(AdditionalContent), typeof(object), typeof(Card),
|
||||
new PropertyMetadata(null));
|
||||
public CardType Type
|
||||
{
|
||||
get { return (CardType)GetValue(TypeProperty); }
|
||||
set { SetValue(TypeProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty TypeProperty =
|
||||
DependencyProperty.Register(nameof(Type), typeof(CardType), typeof(Card),
|
||||
new PropertyMetadata(CardType.Default));
|
||||
}
|
||||
}
|
||||
313
Flow.Launcher/Resources/Controls/ExCard.xaml
Normal file
313
Flow.Launcher/Resources/Controls/ExCard.xaml
Normal file
|
|
@ -0,0 +1,313 @@
|
|||
<UserControl
|
||||
x:Class="Flow.Launcher.Resources.Controls.ExCard"
|
||||
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.Resources.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
mc:Ignorable="d">
|
||||
<UserControl.Template>
|
||||
<ControlTemplate TargetType="UserControl">
|
||||
<Expander
|
||||
x:Name="expanderHeader"
|
||||
Padding="0"
|
||||
BorderThickness="1"
|
||||
IsExpanded="{Binding Mode=TwoWay, Path=IsExpanded}"
|
||||
SnapsToDevicePixels="False">
|
||||
<Expander.Style>
|
||||
<Style TargetType="{x:Type Expander}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
|
||||
<Setter Property="Background" Value="{DynamicResource Color00B}" />
|
||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Color03B}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type Expander}">
|
||||
<Border
|
||||
x:Name="Bd"
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="5"
|
||||
SnapsToDevicePixels="true">
|
||||
<DockPanel>
|
||||
<ToggleButton
|
||||
x:Name="HeaderSite"
|
||||
MinWidth="0"
|
||||
MinHeight="68"
|
||||
Margin="0,0,0,0"
|
||||
Padding="0,0,0,0"
|
||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Header}"
|
||||
ContentTemplate="{TemplateBinding HeaderTemplate}"
|
||||
ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
|
||||
DockPanel.Dock="Top"
|
||||
FocusVisualStyle="{DynamicResource ExpanderHeaderFocusVisual}"
|
||||
FontFamily="{TemplateBinding FontFamily}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontStretch="{TemplateBinding FontStretch}"
|
||||
FontStyle="{TemplateBinding FontStyle}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsChecked="{Binding IsExpanded, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}">
|
||||
<ToggleButton.Style>
|
||||
<Style TargetType="{x:Type ToggleButton}">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
||||
<Border
|
||||
x:Name="ToggleBtn"
|
||||
Padding="{TemplateBinding Padding}"
|
||||
Background="{DynamicResource Color00B}"
|
||||
ClipToBounds="True"
|
||||
CornerRadius="5">
|
||||
<Grid SnapsToDevicePixels="True">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentPresenter
|
||||
Grid.Column="0"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
RecognizesAccessKey="True"
|
||||
SnapsToDevicePixels="True" />
|
||||
<Grid
|
||||
x:Name="ChevronGrid"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,18,0"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
RenderTransformOrigin="0.5, 0.5">
|
||||
<Grid.RenderTransform>
|
||||
<RotateTransform Angle="0" />
|
||||
</Grid.RenderTransform>
|
||||
<Ellipse
|
||||
x:Name="circle"
|
||||
Width="19"
|
||||
Height="19"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Stroke="Transparent" />
|
||||
<Path
|
||||
x:Name="arrow"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Data="M 1,1.5 L 4.5,5 L 8,1.5"
|
||||
SnapsToDevicePixels="false"
|
||||
Stroke="#666"
|
||||
StrokeThickness="1" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsChecked" Value="true">
|
||||
<Setter TargetName="arrow" Property="Data" Value="M 1,4.5 L 4.5,1 L 8,4.5" />
|
||||
<Setter TargetName="ToggleBtn" Property="CornerRadius" Value="5 5 0 0" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsMouseOver" Value="true">
|
||||
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
|
||||
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color05B}" />
|
||||
<Setter TargetName="ToggleBtn" Property="Background" Value="{DynamicResource CustomExpanderHover}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsPressed" Value="true">
|
||||
<Setter TargetName="circle" Property="Stroke" Value="Transparent" />
|
||||
<Setter TargetName="circle" Property="StrokeThickness" Value="1.5" />
|
||||
<Setter TargetName="arrow" Property="Stroke" Value="{DynamicResource Color17B}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
|
||||
</Style>
|
||||
</ToggleButton.Style>
|
||||
</ToggleButton>
|
||||
<Border x:Name="ContentPresenterBorder" BorderThickness="0">
|
||||
<ContentPresenter
|
||||
x:Name="ExpandSite"
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
DockPanel.Dock="Bottom"
|
||||
Focusable="false" />
|
||||
<Border.LayoutTransform>
|
||||
<ScaleTransform ScaleY="0" />
|
||||
</Border.LayoutTransform>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsExpanded" Value="true">
|
||||
<Setter TargetName="ExpandSite" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="ContentPresenterBorder" Property="BorderThickness" Value="0,0,0,0" />
|
||||
<Trigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="ContentPresenterBorder"
|
||||
Storyboard.TargetProperty="(Border.LayoutTransform).(ScaleTransform.ScaleY)"
|
||||
From="0.0"
|
||||
To="1.0"
|
||||
Duration="00:00:00.00" />
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="ContentPresenterBorder"
|
||||
Storyboard.TargetProperty="(Border.Opacity)"
|
||||
From="0.0"
|
||||
To="1.0"
|
||||
Duration="00:00:00.00" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.EnterActions>
|
||||
<Trigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="ContentPresenterBorder"
|
||||
Storyboard.TargetProperty="(Border.LayoutTransform).(ScaleTransform.ScaleY)"
|
||||
From="1.0"
|
||||
To="0"
|
||||
Duration="00:00:00.00" />
|
||||
<!-- Animation 00:00:00.167 -->
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="ContentPresenterBorder"
|
||||
Storyboard.TargetProperty="(Border.Opacity)"
|
||||
From="1.0"
|
||||
To="0.0"
|
||||
Duration="00:00:00.00" />
|
||||
<!-- Animation 00:00:00.167 -->
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</Trigger.ExitActions>
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Right">
|
||||
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Right" />
|
||||
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Left" />
|
||||
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderRightHeaderStyle}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Up">
|
||||
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Top" />
|
||||
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Bottom" />
|
||||
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderUpHeaderStyle}" />
|
||||
</Trigger>
|
||||
<Trigger Property="ExpandDirection" Value="Left">
|
||||
<Setter TargetName="ExpandSite" Property="DockPanel.Dock" Value="Left" />
|
||||
<Setter TargetName="HeaderSite" Property="DockPanel.Dock" Value="Right" />
|
||||
<Setter TargetName="HeaderSite" Property="Style" Value="{StaticResource ExpanderLeftHeaderStyle}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsEnabled" Value="false">
|
||||
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</Expander.Style>
|
||||
<Expander.Header>
|
||||
<Border Margin="0" Padding="0,12,0,12">
|
||||
<Grid Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Expander}}, Path=ActualWidth}" HorizontalAlignment="Left">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition
|
||||
Width="auto"
|
||||
MinWidth="20"
|
||||
MaxWidth="60" />
|
||||
<ColumnDefinition Width="7*" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="30" />
|
||||
<ColumnDefinition Width="Auto" MinWidth="30" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ContentControl
|
||||
x:Name="firstContentPresenter"
|
||||
Grid.Column="2"
|
||||
Margin="0,0,14,0"
|
||||
HorizontalAlignment="Right"
|
||||
Content="{Binding SideContent, RelativeSource={RelativeSource AncestorType=local:ExCard}}" />
|
||||
<TextBlock
|
||||
x:Name="ItemIcon"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Center"
|
||||
Text="{Binding Icon, RelativeSource={RelativeSource AncestorType=local:ExCard}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=ItemIcon, Path=Text}" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Margin" Value="24,0,0,0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Grid.Column" Value="0" />
|
||||
<Setter Property="Margin" Value="24,0,16,0" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="FontSize" Value="20" />
|
||||
<Setter Property="FontFamily" Value="/Resources/#Segoe Fluent Icons" />
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<StackPanel Grid.Column="1" Margin="0,0,14,0">
|
||||
<StackPanel.Style>
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="Grid.Column" Value="1" />
|
||||
<Setter Property="Width" Value="Auto" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
<Setter Property="HorizontalAlignment" Value="Left" />
|
||||
|
||||
</Style>
|
||||
</StackPanel.Style>
|
||||
<TextBlock x:Name="ItemTitle" Text="{Binding Title, RelativeSource={RelativeSource AncestorType=local:ExCard}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="TextWrapping" Value="Wrap" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
<TextBlock x:Name="SubTitle" Text="{Binding Sub, RelativeSource={RelativeSource AncestorType=local:ExCard}}">
|
||||
<TextBlock.Style>
|
||||
<Style TargetType="{x:Type TextBlock}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding ElementName=SubTitle, Path=Text}" Value="{x:Static sys:String.Empty}">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
<Setter Property="Foreground" Value="{DynamicResource Color04B}" />
|
||||
<Setter Property="FontSize" Value="12" />
|
||||
<Setter Property="Margin" Value="0,0,0,0" />
|
||||
<Setter Property="Padding" Value="0,0,24,0" />
|
||||
<Setter Property="TextWrapping" Value="WrapWithOverflow" />
|
||||
</Style>
|
||||
</TextBlock.Style>
|
||||
</TextBlock>
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
</Border>
|
||||
</Expander.Header>
|
||||
<Grid
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
HorizontalAlignment="Stretch"
|
||||
FlowDirection="LeftToRight">
|
||||
<StackPanel Margin="0,0,0,0" Orientation="Vertical">
|
||||
<ContentControl
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="4"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</UserControl.Template>
|
||||
</UserControl>
|
||||
57
Flow.Launcher/Resources/Controls/ExCard.xaml.cs
Normal file
57
Flow.Launcher/Resources/Controls/ExCard.xaml.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Flow.Launcher.Resources.Controls
|
||||
{
|
||||
public partial class ExCard : UserControl
|
||||
{
|
||||
public ExCard()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public string Title
|
||||
{
|
||||
get { return (string)GetValue(TitleProperty); }
|
||||
set { SetValue(TitleProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty TitleProperty =
|
||||
DependencyProperty.Register(nameof(Title), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string Sub
|
||||
{
|
||||
get { return (string)GetValue(SubProperty); }
|
||||
set { SetValue(SubProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SubProperty =
|
||||
DependencyProperty.Register(nameof(Sub), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
|
||||
|
||||
public string Icon
|
||||
{
|
||||
get { return (string)GetValue(IconProperty); }
|
||||
set { SetValue(IconProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty IconProperty =
|
||||
DependencyProperty.Register(nameof(Icon), typeof(string), typeof(ExCard), new PropertyMetadata(string.Empty));
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets additional content for the UserControl
|
||||
/// </summary>
|
||||
public object AdditionalContent
|
||||
{
|
||||
get { return (object)GetValue(AdditionalContentProperty); }
|
||||
set { SetValue(AdditionalContentProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty AdditionalContentProperty =
|
||||
DependencyProperty.Register(nameof(AdditionalContent), typeof(object), typeof(ExCard),
|
||||
new PropertyMetadata(null));
|
||||
|
||||
public object SideContent
|
||||
{
|
||||
get { return (object)GetValue(SideContentProperty); }
|
||||
set { SetValue(SideContentProperty, value); }
|
||||
}
|
||||
public static readonly DependencyProperty SideContentProperty =
|
||||
DependencyProperty.Register(nameof(SideContent), typeof(object), typeof(ExCard),
|
||||
new PropertyMetadata(null));
|
||||
}
|
||||
}
|
||||
74
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml
Normal file
74
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
<UserControl
|
||||
x:Class="Flow.Launcher.Resources.Controls.HotkeyDisplay"
|
||||
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.Resources.Controls"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Grid>
|
||||
<Button
|
||||
Width="Auto"
|
||||
FontSize="13"
|
||||
FontWeight="Bold"
|
||||
Foreground="{DynamicResource Color01B}">
|
||||
<Button.Template>
|
||||
<ControlTemplate TargetType="Button">
|
||||
<Border
|
||||
x:Name="ButtonBorder"
|
||||
BorderBrush="{DynamicResource ButtonInsideBorder}"
|
||||
CornerRadius="5">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="Background" Value="{DynamicResource Color12B}" />
|
||||
<Setter Property="Padding" Value="5,0,5,0" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:HotkeyDisplay}}" Value="Small">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
<Setter Property="Padding" Value="0,0,0,0" />
|
||||
<Setter Property="BorderThickness" Value="0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Button.Template>
|
||||
<Button.Content>
|
||||
<ItemsControl x:Name="KeysControl">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Orientation="Horizontal" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border BorderThickness="1" CornerRadius="5">
|
||||
<Border.Style>
|
||||
<Style TargetType="{x:Type Border}">
|
||||
<Setter Property="Background" Value="{DynamicResource SystemControlBackgroundBaseLowBrush}" />
|
||||
<Setter Property="Padding" Value="10,5,10,5" />
|
||||
<Setter Property="Margin" Value="2,5,2,5" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Type, RelativeSource={RelativeSource AncestorType=local:HotkeyDisplay}}" Value="Small">
|
||||
<Setter Property="Background" Value="{DynamicResource AccentButtonBackground}" />
|
||||
<Setter Property="Padding" Value="10,5,10,5" />
|
||||
<Setter Property="Margin" Value="2,0,2,0" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<TextBlock Foreground="{DynamicResource AccentButtonForegroundPointerOver}" Text="{Binding}" />
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Button.Content>
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
63
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs
Normal file
63
Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs
Normal file
|
|
@ -0,0 +1,63 @@
|
|||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace Flow.Launcher.Resources.Controls
|
||||
{
|
||||
public partial class HotkeyDisplay : UserControl
|
||||
{
|
||||
public enum DisplayType
|
||||
{
|
||||
Default,
|
||||
Small
|
||||
}
|
||||
|
||||
public HotkeyDisplay()
|
||||
{
|
||||
InitializeComponent();
|
||||
//List<string> stringList =e.NewValue.Split('+').ToList();
|
||||
Values = new ObservableCollection<string>();
|
||||
KeysControl.ItemsSource = Values;
|
||||
}
|
||||
|
||||
public string Keys
|
||||
{
|
||||
get { return (string)GetValue(KeysProperty); }
|
||||
set { SetValue(KeysProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty KeysProperty =
|
||||
DependencyProperty.Register(nameof(Keys), typeof(string), typeof(HotkeyDisplay),
|
||||
new PropertyMetadata(string.Empty, keyChanged));
|
||||
|
||||
public DisplayType Type
|
||||
{
|
||||
get { return (DisplayType)GetValue(TypeProperty); }
|
||||
set { SetValue(TypeProperty, value); }
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty TypeProperty =
|
||||
DependencyProperty.Register(nameof(Type), typeof(DisplayType), typeof(HotkeyDisplay),
|
||||
new PropertyMetadata(DisplayType.Default));
|
||||
|
||||
private static void keyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var control = d as UserControl;
|
||||
if (null == control) return; // This should not be possible
|
||||
|
||||
var newValue = e.NewValue as string;
|
||||
if (null == newValue) return;
|
||||
|
||||
if (d is not HotkeyDisplay hotkeyDisplay)
|
||||
return;
|
||||
|
||||
hotkeyDisplay.Values.Clear();
|
||||
foreach (var key in newValue.Split('+'))
|
||||
{
|
||||
hotkeyDisplay.Values.Add(key);
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<string> Values { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -3283,5 +3283,416 @@
|
|||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
|
||||
<!-- Content Dialog -->
|
||||
<Style x:Key="ContentDialog" TargetType="ui:ContentDialog">
|
||||
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
|
||||
<Setter Property="Background" Value="{DynamicResource ContentDialogBackground}" />
|
||||
<Setter Property="BorderThickness" Value="{DynamicResource ContentDialogBorderWidth}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource ContentDialogBorderBrush}" />
|
||||
<Setter Property="IsTabStop" Value="False" />
|
||||
<Setter Property="CornerRadius" Value="{DynamicResource OverlayCornerRadius}" />
|
||||
<Setter Property="PrimaryButtonStyle" Value="{DynamicResource DefaultButtonStyle}" />
|
||||
<Setter Property="SecondaryButtonStyle" Value="{DynamicResource DefaultButtonStyle}" />
|
||||
<Setter Property="CloseButtonStyle" Value="{DynamicResource DefaultButtonStyle}" />
|
||||
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
|
||||
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
||||
<Setter Property="IsShadowEnabled" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ui:ContentDialog">
|
||||
<Border x:Name="Container">
|
||||
<VisualStateManager.CustomVisualStateManager>
|
||||
<ui:SimpleVisualStateManager />
|
||||
</VisualStateManager.CustomVisualStateManager>
|
||||
<Grid
|
||||
x:Name="LayoutRoot"
|
||||
Background="{DynamicResource ContentDialogOverlayBG}"
|
||||
SnapsToDevicePixels="True"
|
||||
Visibility="Collapsed">
|
||||
<Grid
|
||||
x:Name="BackgroundElement"
|
||||
MinWidth="{DynamicResource ContentDialogMinWidth}"
|
||||
MinHeight="{DynamicResource ContentDialogMinHeight}"
|
||||
MaxWidth="{DynamicResource ContentDialogMaxWidth}"
|
||||
MaxHeight="{DynamicResource ContentDialogMaxHeight}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
FlowDirection="{TemplateBinding FlowDirection}"
|
||||
RenderTransformOrigin="0.5,0.5">
|
||||
<Grid.RenderTransform>
|
||||
<ScaleTransform x:Name="ScaleTransform" />
|
||||
</Grid.RenderTransform>
|
||||
<ui:ThemeShadowChrome
|
||||
x:Name="Shdw"
|
||||
Margin="{DynamicResource ContentDialogBorderWidth}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
IsShadowEnabled="{TemplateBinding IsShadowEnabled}" />
|
||||
<Border
|
||||
Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}">
|
||||
<Border x:Name="DialogSpace" Padding="{DynamicResource ContentDialogPadding}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer
|
||||
x:Name="ContentScrollViewer"
|
||||
Margin="{DynamicResource ContentDialogContentScrollViewerMargin}"
|
||||
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||
IsTabStop="False"
|
||||
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ContentControl
|
||||
x:Name="Title"
|
||||
Margin="{DynamicResource ContentDialogTitleMargin}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
Content="{TemplateBinding Title}"
|
||||
ContentTemplate="{TemplateBinding TitleTemplate}"
|
||||
FontFamily="{DynamicResource {x:Static SystemFonts.MessageFontFamilyKey}}"
|
||||
FontSize="20"
|
||||
FontWeight="Normal"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
IsTabStop="False"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
||||
<ContentControl.Template>
|
||||
<ControlTemplate TargetType="ContentControl">
|
||||
<ui:ContentPresenterEx
|
||||
Margin="{TemplateBinding Padding}"
|
||||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
TextWrapping="Wrap" />
|
||||
</ControlTemplate>
|
||||
</ContentControl.Template>
|
||||
</ContentControl>
|
||||
<ui:ContentPresenterEx
|
||||
x:Name="Content"
|
||||
Grid.Row="1"
|
||||
Margin="{DynamicResource ContentDialogContentMargin}"
|
||||
Content="{TemplateBinding Content}"
|
||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||||
TextElement.FontFamily="{DynamicResource ContentControlThemeFontFamily}"
|
||||
TextElement.FontSize="{DynamicResource ControlContentThemeFontSize}"
|
||||
TextElement.Foreground="{TemplateBinding Foreground}"
|
||||
TextWrapping="Wrap" />
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<Grid
|
||||
x:Name="CommandSpace"
|
||||
Grid.Row="1"
|
||||
Margin="{DynamicResource ContentDialogCommandSpaceMargin}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Bottom"
|
||||
KeyboardNavigation.DirectionalNavigation="Contained">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition Width="0.5*" />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Name="PrimaryButton"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{TemplateBinding PrimaryButtonText}"
|
||||
IsEnabled="{TemplateBinding IsPrimaryButtonEnabled}"
|
||||
Style="{TemplateBinding PrimaryButtonStyle}" />
|
||||
<Button
|
||||
x:Name="SecondaryButton"
|
||||
Grid.Column="1"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="2,0,2,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{TemplateBinding SecondaryButtonText}"
|
||||
IsEnabled="{TemplateBinding IsSecondaryButtonEnabled}"
|
||||
Style="{TemplateBinding SecondaryButtonStyle}" />
|
||||
<Button
|
||||
x:Name="CloseButton"
|
||||
Grid.Column="3"
|
||||
Margin="2,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
Content="{TemplateBinding CloseButtonText}"
|
||||
Style="{TemplateBinding CloseButtonStyle}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="DialogShowingStates">
|
||||
<VisualStateGroup.Transitions>
|
||||
<VisualTransition To="DialogHidden">
|
||||
<Storyboard>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="SnapsToDevicePixels">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="IsHitTestVisible">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.1,0.9 0.2,1.0"
|
||||
KeyTime="0:0:0.5"
|
||||
Value="1.05" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.1,0.9 0.2,1.0"
|
||||
KeyTime="0:0:0.5"
|
||||
Value="1.05" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.0" />
|
||||
<LinearDoubleKeyFrame KeyTime="0:0:0.083" Value="0.0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualTransition>
|
||||
<VisualTransition To="DialogShowing">
|
||||
<Storyboard>
|
||||
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="SnapsToDevicePixels">
|
||||
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
|
||||
</BooleanAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleX">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.05" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.1,0.9 0.2,1.0"
|
||||
KeyTime="0:0:0.5"
|
||||
Value="1.0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="ScaleTransform" Storyboard.TargetProperty="ScaleY">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="1.05" />
|
||||
<SplineDoubleKeyFrame
|
||||
KeySpline="0.1,0.9 0.2,1.0"
|
||||
KeyTime="0:0:0.5"
|
||||
Value="1.0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Opacity">
|
||||
<DiscreteDoubleKeyFrame KeyTime="0:0:0" Value="0.0" />
|
||||
<LinearDoubleKeyFrame KeyTime="0:0:0.167" Value="1.0" />
|
||||
</DoubleAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualTransition>
|
||||
</VisualStateGroup.Transitions>
|
||||
<VisualState x:Name="DialogHidden" />
|
||||
<VisualState x:Name="DialogShowing">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement" Storyboard.TargetProperty="(KeyboardNavigation.TabNavigation)">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static KeyboardNavigationMode.Cycle}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="DialogShowingWithoutSmokeLayer">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Background">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Null}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="DialogSizingStates">
|
||||
<VisualState x:Name="DefaultDialogSizing" />
|
||||
<VisualState x:Name="FullDialogSizing">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement" Storyboard.TargetProperty="VerticalAlignment">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static VerticalAlignment.Stretch}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="ButtonsVisibilityStates">
|
||||
<VisualState x:Name="AllVisible" />
|
||||
<VisualState x:Name="NoneVisible">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CommandSpace" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PrimaryVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SecondaryVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="CloseVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PrimaryAndSecondaryVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="PrimaryAndCloseVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
<VisualState x:Name="SecondaryAndCloseVisible">
|
||||
<Storyboard>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="0" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="SecondaryButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="0,0,2,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.Column)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<Int32AnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="(Grid.ColumnSpan)">
|
||||
<DiscreteInt32KeyFrame KeyTime="0:0:0" Value="2" />
|
||||
</Int32AnimationUsingKeyFrames>
|
||||
<ThicknessAnimationUsingKeyFrames Storyboard.TargetName="CloseButton" Storyboard.TargetProperty="Margin">
|
||||
<DiscreteThicknessKeyFrame KeyTime="0:0:0" Value="2,0,0,0" />
|
||||
</ThicknessAnimationUsingKeyFrames>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="PrimaryButton" Storyboard.TargetProperty="Visibility">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Collapsed}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="DefaultButtonStates">
|
||||
<VisualState x:Name="NoDefaultButton" />
|
||||
<VisualState x:Name="PrimaryAsDefaultButton" />
|
||||
<VisualState x:Name="SecondaryAsDefaultButton" />
|
||||
<VisualState x:Name="CloseAsDefaultButton" />
|
||||
</VisualStateGroup>
|
||||
<VisualStateGroup x:Name="DialogBorderStates">
|
||||
<VisualState x:Name="NoBorder" />
|
||||
<VisualState x:Name="AccentColorBorder">
|
||||
<Storyboard>
|
||||
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundElement" Storyboard.TargetProperty="BorderBrush">
|
||||
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{DynamicResource SystemControlForegroundAccentBrush}" />
|
||||
</ObjectAnimationUsingKeyFrames>
|
||||
</Storyboard>
|
||||
</VisualState>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsShadowEnabled" Value="False">
|
||||
<Setter TargetName="Shdw" Property="Visibility" Value="Collapsed" />
|
||||
</Trigger>
|
||||
<Trigger Property="DefaultButton" Value="Primary">
|
||||
<Setter TargetName="PrimaryButton" Property="Style" Value="{DynamicResource AccentButtonStyle}" />
|
||||
</Trigger>
|
||||
<Trigger Property="DefaultButton" Value="Secondary">
|
||||
<Setter TargetName="SecondaryButton" Property="Style" Value="{DynamicResource AccentButtonStyle}" />
|
||||
</Trigger>
|
||||
<Trigger Property="DefaultButton" Value="Close">
|
||||
<Setter TargetName="CloseButton" Property="Style" Value="{DynamicResource AccentButtonStyle}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
||||
|
|
|
|||
|
|
@ -104,6 +104,16 @@
|
|||
<Color x:Key="NumberBoxColor26">#ffffff</Color>
|
||||
<Color x:Key="HoverStoreGrid">#272727</Color>
|
||||
|
||||
<!-- Resources for HotkeyControl -->
|
||||
<SolidColorBrush x:Key="CustomHotkeyHover" Color="#323232" />
|
||||
<!-- Resources for Expander -->
|
||||
<SolidColorBrush x:Key="CustomExpanderHover" Color="#323232" />
|
||||
<!-- Resource for ContentDialog -->
|
||||
<SolidColorBrush x:Key="ContentDialogOverlayBG" Color="#4D000000" />
|
||||
<!-- Infobar Warning -->
|
||||
<SolidColorBrush x:Key="InfoBarWarningIcon" Color="#FCE100" />
|
||||
<SolidColorBrush x:Key="InfoBarWarningBG" Color="#433519" />
|
||||
<SolidColorBrush x:Key="InfoBarBD" Color="#19000000" />
|
||||
|
||||
<SolidColorBrush x:Key="ButtonOutBorder" Color="Transparent" />
|
||||
<SolidColorBrush x:Key="ButtonInsideBorder" Color="#3f3f3f" />
|
||||
|
|
@ -772,7 +782,7 @@
|
|||
<m:StaticResource x:Key="ContentDialogForeground" ResourceKey="SystemControlPageTextBaseHighBrush" />
|
||||
<m:StaticResource x:Key="ContentDialogBackground" ResourceKey="SystemControlPageBackgroundAltHighBrush" />
|
||||
<m:StaticResource x:Key="ContentDialogBorderBrush" ResourceKey="SystemControlBackgroundBaseLowBrush" />
|
||||
<m:StaticResource x:Key="ContentDialogLightDismissOverlayBackground" ResourceKey="SystemControlPageBackgroundMediumAltMediumBrush" />
|
||||
<m:StaticResource x:Key="ContentDialogLightDismissOverlayBackground" ResourceKey="ContentDialogOverlayBG" />
|
||||
|
||||
<!-- Resources for DataGrid -->
|
||||
<sys:Double x:Key="ListAccentLowOpacity">0.6</sys:Double>
|
||||
|
|
|
|||
|
|
@ -95,6 +95,17 @@
|
|||
<Color x:Key="NumberBoxColor26">#1b1b1b</Color>
|
||||
<Color x:Key="HoverStoreGrid">#f6f6f6</Color>
|
||||
|
||||
<!-- Resources for HotkeyControl -->
|
||||
<SolidColorBrush x:Key="CustomHotkeyHover" Color="#f6f6f6" />
|
||||
<!-- Resources for Expander -->
|
||||
<SolidColorBrush x:Key="CustomExpanderHover" Color="#f6f6f6" />
|
||||
<!-- Resource for ContentDialog -->
|
||||
<SolidColorBrush x:Key="ContentDialogOverlayBG" Color="#4D000000" />
|
||||
<!-- Infobar Warning -->
|
||||
<SolidColorBrush x:Key="InfoBarWarningIcon" Color="#9D5D00" />
|
||||
<SolidColorBrush x:Key="InfoBarWarningBG" Color="#FFF4CE" />
|
||||
<SolidColorBrush x:Key="InfoBarBD" Color="#0F000000" />
|
||||
|
||||
|
||||
<SolidColorBrush x:Key="ButtonOutBorder" Color="#e5e5e5" />
|
||||
<SolidColorBrush x:Key="ButtonInsideBorder" Color="#d3d3d3" />
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@
|
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
Title="WelcomePage2"
|
||||
DataContext="{Binding RelativeSource={RelativeSource Self}}"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<converters:BorderClipConverter x:Key="BorderClipConverter" />
|
||||
|
|
@ -110,12 +111,12 @@
|
|||
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"/>
|
||||
Margin="0,8,0,0"
|
||||
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
|
||||
DefaultHotkey="Alt+Space"
|
||||
Hotkey="{Binding Settings.Hotkey}"
|
||||
ValidateKeyGesture="True"
|
||||
WindowTitle="{DynamicResource flowlauncherHotkey}" />
|
||||
</StackPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
|
|
|||
|
|
@ -5,16 +5,14 @@ using System;
|
|||
using System.Windows;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Navigation;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher.Resources.Pages
|
||||
{
|
||||
public partial class WelcomePage2
|
||||
{
|
||||
private Settings Settings { get; set; }
|
||||
|
||||
private Brush tbMsgForegroundColorOriginal;
|
||||
|
||||
private string tbMsgTextOriginal;
|
||||
public Settings Settings { get; set; }
|
||||
|
||||
protected override void OnNavigatedTo(NavigationEventArgs e)
|
||||
{
|
||||
|
|
@ -22,31 +20,14 @@ namespace Flow.Launcher.Resources.Pages
|
|||
Settings = settings;
|
||||
else
|
||||
throw new ArgumentException("Unexpected Parameter setting.");
|
||||
|
||||
|
||||
InitializeComponent();
|
||||
tbMsgTextOriginal = HotkeyControl.tbMsg.Text;
|
||||
tbMsgForegroundColorOriginal = HotkeyControl.tbMsg.Foreground;
|
||||
|
||||
HotkeyControl.SetHotkeyAsync(Settings.Hotkey, false);
|
||||
}
|
||||
private void HotkeyControl_OnGotFocus(object sender, RoutedEventArgs args)
|
||||
{
|
||||
HotKeyMapper.RemoveHotkey(Settings.Hotkey);
|
||||
}
|
||||
private void HotkeyControl_OnLostFocus(object sender, RoutedEventArgs args)
|
||||
{
|
||||
if (HotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
|
||||
Settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
HotKeyMapper.SetHotkey(new HotkeyModel(Settings.Hotkey), HotKeyMapper.OnToggleHotkey);
|
||||
}
|
||||
|
||||
HotkeyControl.tbMsg.Text = tbMsgTextOriginal;
|
||||
HotkeyControl.tbMsg.Foreground = tbMsgForegroundColorOriginal;
|
||||
[RelayCommand]
|
||||
private static void SetTogglingHotkey(HotkeyModel hotkey)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,13 @@
|
|||
x:Class="Flow.Launcher.Resources.Pages.WelcomePage3"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Flow.Launcher.Resources.Pages"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||
Title="WelcomePage3"
|
||||
VerticalAlignment="Stretch"
|
||||
mc:Ignorable="d">
|
||||
<Page.Resources>
|
||||
<Style x:Key="KbdLine" TargetType="Border">
|
||||
|
|
@ -27,301 +29,86 @@
|
|||
<Setter Property="Foreground" Value="{DynamicResource Color05B}" />
|
||||
</Style>
|
||||
</Page.Resources>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="0" />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Border Grid.Row="0" HorizontalAlignment="Stretch">
|
||||
<Border.Background>
|
||||
<LinearGradientBrush StartPoint="0 0" EndPoint="1 1">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStop Offset="0.0" Color="#16af7b" />
|
||||
<GradientStop Offset="1.0" Color="#34c191" />
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
</Border.Background>
|
||||
|
||||
<StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
|
||||
<Image
|
||||
Width="300"
|
||||
Height="100"
|
||||
Margin="0,0,0,0"
|
||||
Source="../../images/page_img02.png"
|
||||
Style="{DynamicResource StyleImageFadeIn}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
VerticalScrollBarVisibility="Auto">
|
||||
<Grid>
|
||||
<StackPanel Margin="24,20,24,20">
|
||||
<StackPanel Margin="0,0,0,10">
|
||||
<TextBlock
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource Welcome_Page3_Title}" />
|
||||
</StackPanel>
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="24,20,24,14"
|
||||
FontSize="20"
|
||||
FontWeight="SemiBold"
|
||||
Text="{DynamicResource Welcome_Page3_Title}" />
|
||||
<ScrollViewer
|
||||
Grid.Row="1"
|
||||
Height="478"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
FontSize="13">
|
||||
<StackPanel Margin="24,0,24,0">
|
||||
<Border
|
||||
BorderBrush="{DynamicResource Color03B}"
|
||||
BorderThickness="0"
|
||||
CornerRadius="5">
|
||||
<StackPanel>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyUpDownDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}">←</TextBlock>
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">,</TextBlock>
|
||||
<Border Margin="5,0,0,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}">→</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyUpDownDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="←+→" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyLeftRightDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}">↑</TextBlock>
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">,</TextBlock>
|
||||
<Border Margin="5,0,0,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}">↓</TextBlock>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyLeftRightDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="↑+↓" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyESCDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}">Enter</TextBlock>
|
||||
</Border>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyRunDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="ESC" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyRunDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="ENTER" Type="Small" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyShiftEnterDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="ESC" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyESCDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="SHIFT+ENTER" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyCtrlEnterDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Tab" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyTabDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="CTRL+ENTER" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource HotkeyCtrlShiftEnterDesc}"
|
||||
BorderThickness="0,0,0,0"
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Shift" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyShiftEnterDesc}" />
|
||||
</StackPanel>
|
||||
<cc:HotkeyDisplay Keys="CTRL+SHIFT+ENTER" Type="Small" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyCtrlEnterDesc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Shift" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="ENTER" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyCtrlShiftEnterDesc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="H" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyCtrlHDesc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="Ctrl" />
|
||||
</Border>
|
||||
<TextBlock VerticalAlignment="Center">+</TextBlock>
|
||||
<Border Margin="5,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="I" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyCtrlIDesc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Style="{DynamicResource KbdLine}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<StackPanel
|
||||
Width="210"
|
||||
Margin="20,5,4,5"
|
||||
VerticalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<Border Margin="0,0,5,0" Style="{DynamicResource Kbd}">
|
||||
<TextBlock Style="{DynamicResource KbdText}" Text="F5" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
VerticalAlignment="Center"
|
||||
FontSize="13"
|
||||
Text="{DynamicResource HotkeyF5Desc}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</cc:Card>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
</Grid>
|
||||
</ui:Page>
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
x:Class="Flow.Launcher.SettingWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
|
||||
xmlns:converters="clr-namespace:Flow.Launcher.Converters"
|
||||
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
|
|
@ -2647,63 +2648,37 @@
|
|||
<StackPanel Margin="5,18,18,10">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="0,5,0,2"
|
||||
Margin="0,5,0,6"
|
||||
FontSize="30"
|
||||
Style="{StaticResource PageTitle}"
|
||||
Text="{DynamicResource hotkeys}"
|
||||
TextAlignment="left" />
|
||||
|
||||
<StackPanel Grid.Row="1">
|
||||
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource flowlauncherHotkey}" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource flowlauncherHotkeyToolTip}" />
|
||||
</StackPanel>
|
||||
<flowlauncher:HotkeyControl
|
||||
x:Name="HotkeyControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Width="300"
|
||||
Height="35"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right"
|
||||
GotFocus="OnHotkeyControlFocused"
|
||||
Loaded="OnHotkeyControlLoaded"
|
||||
LostFocus="OnHotkeyControlFocusLost" />
|
||||
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
<cc:Card
|
||||
Title="{DynamicResource flowlauncherHotkey}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource flowlauncherHotkeyToolTip}">
|
||||
<flowlauncher:HotkeyControl
|
||||
ChangeHotkey="{Binding SetTogglingHotkeyCommand}"
|
||||
DefaultHotkey="Alt+Space"
|
||||
Hotkey="{Binding Settings.Hotkey}"
|
||||
ValidateKeyGesture="True"
|
||||
WindowTitle="{DynamicResource flowlauncherHotkey}" />
|
||||
</cc:Card>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Grid.Row="2">
|
||||
<Border Margin="0,8,0,0" Style="{DynamicResource SettingGroupBox}">
|
||||
<ItemsControl Style="{StaticResource SettingGrid}">
|
||||
<StackPanel Style="{StaticResource TextPanel}">
|
||||
<TextBlock Style="{DynamicResource SettingTitleLabel}" Text="{DynamicResource previewHotkey}" />
|
||||
<TextBlock Style="{DynamicResource SettingSubTitleLabel}" Text="{DynamicResource previewHotkeyToolTip}" />
|
||||
</StackPanel>
|
||||
<flowlauncher:HotkeyControl
|
||||
x:Name="PreviewHotkeyControl"
|
||||
Grid.Row="0"
|
||||
Grid.Column="2"
|
||||
Width="300"
|
||||
Height="35"
|
||||
Margin="0,0,0,0"
|
||||
HorizontalAlignment="Right"
|
||||
HorizontalContentAlignment="Right"
|
||||
Loaded="OnPreviewHotkeyControlLoaded"
|
||||
LostFocus="OnPreviewHotkeyControlFocusLost"
|
||||
ValidateKeyGesture="True" />
|
||||
<TextBlock Style="{StaticResource Glyph}">
|
||||

|
||||
</TextBlock>
|
||||
</ItemsControl>
|
||||
</Border>
|
||||
<cc:Card
|
||||
Title="{DynamicResource previewHotkey}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource previewHotkeyToolTip}">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="F1"
|
||||
Hotkey="{Binding Settings.PreviewHotkey}"
|
||||
ValidateKeyGesture="False"
|
||||
WindowTitle="{DynamicResource previewHotkey}" />
|
||||
</cc:Card>
|
||||
</StackPanel>
|
||||
|
||||
<Border
|
||||
|
|
@ -2763,163 +2738,359 @@
|
|||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
Margin="0,10,12,10"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource customQueryHotkey}" />
|
||||
<ListView
|
||||
Grid.Row="5"
|
||||
MinHeight="160"
|
||||
Margin="0,0,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding Settings.CustomPluginHotkeys}"
|
||||
SelectedItem="{Binding SelectedCustomPluginHotkey}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource hotkey}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||
<TextBlock Text="{Binding Hotkey}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customQuery}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||
<TextBlock Text="{Binding ActionKeyword}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="6"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnDeleteCustomHotkeyClick"
|
||||
Content="{DynamicResource delete}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnEditCustomHotkeyClick"
|
||||
Content="{DynamicResource edit}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10,10,0,10"
|
||||
Click="OnAddCustomHotkeyClick"
|
||||
Content="{DynamicResource add}" />
|
||||
<StackPanel Grid.Row="2">
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource hotkeyPresets}"
|
||||
Margin="0,14,0,0"
|
||||
Icon=""
|
||||
Sub="{DynamicResource hotkeyPresetsToolTip}">
|
||||
<StackPanel>
|
||||
<cc:Card
|
||||
Title="{DynamicResource OpenContainFolderHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+Enter" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource RunAsAdminHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+Shift+Enter" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource ToggleHistoryHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+H" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource CopyFilePathHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+Shift+C" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource OpenContextMenuHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="Ctrl+I"
|
||||
Hotkey="{Binding Settings.OpenContextMenuHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource OpenContextMenuHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Shift+Enter" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card
|
||||
Title="{DynamicResource SettingWindowHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="Ctrl+I"
|
||||
Hotkey="{Binding Settings.SettingWindowHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource ToggleGameModeHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+Shift+C" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource ReloadPluginHotkey}"
|
||||
Icon=""
|
||||
Sub="{DynamicResource ReloadPluginHotkeyToolTip}"
|
||||
Type="Inside">
|
||||
<cc:HotkeyDisplay Keys="F5" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource SelectNextPageHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectNextPageHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource SelectPrevPageHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectPrevPageHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
|
||||
<cc:Card
|
||||
Title="{DynamicResource QuickWidthHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+[" />
|
||||
<cc:HotkeyDisplay Margin="4,0,0,0" Keys="Ctrl+]" />
|
||||
</StackPanel>
|
||||
</cc:Card>
|
||||
<cc:Card
|
||||
Title="{DynamicResource QuickHeightHotkey}"
|
||||
Icon=""
|
||||
Type="Inside">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<cc:HotkeyDisplay Keys="Ctrl+Plus" />
|
||||
<cc:HotkeyDisplay Margin="4,0,0,0" Keys="Ctrl+Minus" />
|
||||
</StackPanel>
|
||||
</cc:Card>
|
||||
</StackPanel>
|
||||
</cc:ExCard>
|
||||
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource autoCompleteHotkey}"
|
||||
Margin="0,14,0,0"
|
||||
Icon=""
|
||||
Sub="{DynamicResource autoCompleteHotkeyToolTip}">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="Ctrl+Tab"
|
||||
Hotkey="{Binding Settings.AutoCompleteHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
Title="{DynamicResource autoCompleteHotkey}"
|
||||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.AutoCompleteHotkey2}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource SelectNextItemHotkey}"
|
||||
Margin="0,4,0,0"
|
||||
Icon="">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="Tab"
|
||||
Hotkey="{Binding Settings.SelectNextItemHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
Title="{DynamicResource SelectNextItemHotkey}"
|
||||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectNextItemHotkey2}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource SelectPrevItemHotkey}"
|
||||
Margin="0,4,0,0"
|
||||
Icon="">
|
||||
<cc:ExCard.SideContent>
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey="Shift+Tab"
|
||||
Hotkey="{Binding Settings.SelectPrevItemHotkey}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:ExCard.SideContent>
|
||||
<cc:Card
|
||||
Title="{DynamicResource SelectPrevItemHotkey}"
|
||||
Sub="{DynamicResource AdditionalHotkeyToolTip}"
|
||||
Type="InsideFit">
|
||||
<flowlauncher:HotkeyControl
|
||||
DefaultHotkey=""
|
||||
Hotkey="{Binding Settings.SelectPrevItemHotkey2}"
|
||||
ValidateKeyGesture="False" />
|
||||
</cc:Card>
|
||||
</cc:ExCard>
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource customQueryHotkey}"
|
||||
Margin="0,20,0,0"
|
||||
Icon="">
|
||||
<StackPanel Margin="0,0,0,0">
|
||||
<Separator
|
||||
Width="Auto"
|
||||
Margin="0"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource SettingSeparatorStyle}" />
|
||||
<StackPanel Margin="18,18,18,0">
|
||||
<ListView
|
||||
Grid.Row="5"
|
||||
MinHeight="160"
|
||||
Margin="0,0,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding Settings.CustomPluginHotkeys}"
|
||||
SelectedItem="{Binding SelectedCustomPluginHotkey}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource hotkey}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||
<TextBlock Text="{Binding Hotkey}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customQuery}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate DataType="userSettings:CustomPluginHotkey">
|
||||
<TextBlock Text="{Binding ActionKeyword}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="6"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnDeleteCustomHotkeyClick"
|
||||
Content="{DynamicResource delete}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnEditCustomHotkeyClick"
|
||||
Content="{DynamicResource edit}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10,10,0,10"
|
||||
Click="OnAddCustomHotkeyClick"
|
||||
Content="{DynamicResource add}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</cc:ExCard>
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource customQueryShortcut}"
|
||||
Margin="0,4,0,0"
|
||||
Icon="">
|
||||
<StackPanel>
|
||||
<Separator
|
||||
Width="Auto"
|
||||
Margin="0"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource SettingSeparatorStyle}" />
|
||||
<StackPanel Margin="18,12,18,0">
|
||||
<ListView
|
||||
Grid.Row="8"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding CustomShortcuts}"
|
||||
SelectedItem="{Binding SelectedCustomShortcut}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource customShortcut}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customShortcutExpansion}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Value}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="9"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnDeleteCustomShortCutClick"
|
||||
Content="{DynamicResource delete}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnEditCustomShortCutClick"
|
||||
Content="{DynamicResource edit}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10,10,0,10"
|
||||
Click="OnAddCustomShortCutClick"
|
||||
Content="{DynamicResource add}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</cc:ExCard>
|
||||
|
||||
<cc:ExCard
|
||||
Title="{DynamicResource builtinShortcuts}"
|
||||
Margin="0,4,0,14"
|
||||
Icon="">
|
||||
<StackPanel>
|
||||
<Separator
|
||||
Width="Auto"
|
||||
Margin="0"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource SettingSeparatorStyle}" />
|
||||
<StackPanel Margin="16,8,16,0">
|
||||
<ListView
|
||||
Grid.Row="11"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,16"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding BuiltinShortcuts}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource customShortcut}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource builtinShortcutDescription}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Description, Converter={StaticResource TranslationConverter}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</cc:ExCard>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="7"
|
||||
Margin="0,0,12,2"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource customQueryShortcut}" />
|
||||
<ListView
|
||||
Name="customShortcutView"
|
||||
Grid.Row="8"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,0"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding CustomShortcuts}"
|
||||
SelectedItem="{Binding SelectedCustomShortcut}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource customShortcut}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource customShortcutExpansion}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Value}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel
|
||||
Grid.Row="9"
|
||||
Margin="0"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Top"
|
||||
Orientation="Horizontal">
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnDeleteCustomShortCutClick"
|
||||
Content="{DynamicResource delete}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10"
|
||||
Click="OnEditCustomShortCutClick"
|
||||
Content="{DynamicResource edit}" />
|
||||
<Button
|
||||
MinWidth="100"
|
||||
Margin="10,10,0,10"
|
||||
Click="OnAddCustomShortCutClick"
|
||||
Content="{DynamicResource add}" />
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="10"
|
||||
Margin="0,0,12,2"
|
||||
Padding="0,12,0,0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="14"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource builtinShortcuts}" />
|
||||
<ListView
|
||||
Grid.Row="11"
|
||||
MinHeight="160"
|
||||
Margin="0,6,0,20"
|
||||
Background="{DynamicResource Color02B}"
|
||||
BorderBrush="DarkGray"
|
||||
BorderThickness="1"
|
||||
ItemsSource="{Binding BuiltinShortcuts}"
|
||||
Style="{StaticResource {x:Static GridView.GridViewStyleKey}}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Width="180" Header="{DynamicResource customShortcut}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Key}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Width="430" Header="{DynamicResource builtinShortcutDescription}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Description, Converter={StaticResource TranslationConverter}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</ScrollViewer>
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ using System.Windows.Forms;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Navigation;
|
||||
using NHotkey;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
using KeyEventArgs = System.Windows.Input.KeyEventArgs;
|
||||
|
|
@ -110,41 +111,9 @@ namespace Flow.Launcher
|
|||
|
||||
#region Hotkey
|
||||
|
||||
private void OnHotkeyControlLoaded(object sender, RoutedEventArgs e)
|
||||
private void OnToggleHotkey(object sender, HotkeyEventArgs e)
|
||||
{
|
||||
_ = HotkeyControl.SetHotkeyAsync(viewModel.Settings.Hotkey, false);
|
||||
}
|
||||
|
||||
private void OnHotkeyControlFocused(object sender, RoutedEventArgs e)
|
||||
{
|
||||
HotKeyMapper.RemoveHotkey(settings.Hotkey);
|
||||
}
|
||||
|
||||
private void OnHotkeyControlFocusLost(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (HotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(HotkeyControl.CurrentHotkey, HotKeyMapper.OnToggleHotkey);
|
||||
HotKeyMapper.RemoveHotkey(settings.Hotkey);
|
||||
settings.Hotkey = HotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
HotKeyMapper.SetHotkey(new HotkeyModel(settings.Hotkey), HotKeyMapper.OnToggleHotkey);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPreviewHotkeyControlLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_ = PreviewHotkeyControl.SetHotkeyAsync(settings.PreviewHotkey, false);
|
||||
}
|
||||
|
||||
private void OnPreviewHotkeyControlFocusLost(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (PreviewHotkeyControl.CurrentHotkeyAvailable)
|
||||
{
|
||||
settings.PreviewHotkey = PreviewHotkeyControl.CurrentHotkey.ToString();
|
||||
}
|
||||
HotKeyMapper.OnToggleHotkey(sender, e);
|
||||
}
|
||||
|
||||
private void OnDeleteCustomHotkeyClick(object sender, RoutedEventArgs e)
|
||||
|
|
@ -391,7 +360,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
if (viewModel.EditSelectedCustomShortcut())
|
||||
{
|
||||
customShortcutView.Items.Refresh();
|
||||
//customShortcutView.Items.Refresh(); Should Fix
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,36 @@ namespace Flow.Launcher.ViewModel
|
|||
case nameof(Settings.PreviewHotkey):
|
||||
OnPropertyChanged(nameof(PreviewHotkey));
|
||||
break;
|
||||
case nameof(Settings.AutoCompleteHotkey):
|
||||
OnPropertyChanged(nameof(AutoCompleteHotkey));
|
||||
break;
|
||||
case nameof(Settings.AutoCompleteHotkey2):
|
||||
OnPropertyChanged(nameof(AutoCompleteHotkey2));
|
||||
break;
|
||||
case nameof(Settings.SelectNextItemHotkey):
|
||||
OnPropertyChanged(nameof(SelectNextItemHotkey));
|
||||
break;
|
||||
case nameof(Settings.SelectNextItemHotkey2):
|
||||
OnPropertyChanged(nameof(SelectNextItemHotkey2));
|
||||
break;
|
||||
case nameof(Settings.SelectPrevItemHotkey):
|
||||
OnPropertyChanged(nameof(SelectPrevItemHotkey));
|
||||
break;
|
||||
case nameof(Settings.SelectPrevItemHotkey2):
|
||||
OnPropertyChanged(nameof(SelectPrevItemHotkey2));
|
||||
break;
|
||||
case nameof(Settings.SelectNextPageHotkey):
|
||||
OnPropertyChanged(nameof(SelectNextPageHotkey));
|
||||
break;
|
||||
case nameof(Settings.SelectPrevPageHotkey):
|
||||
OnPropertyChanged(nameof(SelectPrevPageHotkey));
|
||||
break;
|
||||
case nameof(Settings.OpenContextMenuHotkey):
|
||||
OnPropertyChanged(nameof(OpenContextMenuHotkey));
|
||||
break;
|
||||
case nameof(Settings.SettingWindowHotkey):
|
||||
OnPropertyChanged(nameof(SettingWindowHotkey));
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -342,6 +372,13 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedResults.SelectFirstResult();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectLastResult()
|
||||
{
|
||||
SelectedResults.SelectLastResult();
|
||||
}
|
||||
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectPrevPage()
|
||||
{
|
||||
|
|
@ -627,25 +664,33 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public string OpenResultCommandModifiers => Settings.OpenResultModifiers;
|
||||
|
||||
public string PreviewHotkey
|
||||
public string VerifyOrSetDefaultHotkey(string hotkey, string defaultHotkey)
|
||||
{
|
||||
get
|
||||
try
|
||||
{
|
||||
// TODO try to patch issue #1755
|
||||
// Added in v1.14.0, remove after v1.16.0.
|
||||
try
|
||||
{
|
||||
var converter = new KeyGestureConverter();
|
||||
var key = (KeyGesture)converter.ConvertFromString(Settings.PreviewHotkey);
|
||||
}
|
||||
catch (Exception e) when (e is NotSupportedException || e is InvalidEnumArgumentException)
|
||||
{
|
||||
Settings.PreviewHotkey = "F1";
|
||||
}
|
||||
|
||||
return Settings.PreviewHotkey;
|
||||
var converter = new KeyGestureConverter();
|
||||
var key = (KeyGesture)converter.ConvertFromString(hotkey);
|
||||
}
|
||||
catch (Exception e) when (e is NotSupportedException || e is InvalidEnumArgumentException)
|
||||
{
|
||||
return defaultHotkey;
|
||||
}
|
||||
|
||||
return hotkey;
|
||||
}
|
||||
|
||||
public string PreviewHotkey => VerifyOrSetDefaultHotkey(Settings.PreviewHotkey, "F1");
|
||||
public string AutoCompleteHotkey => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey, "Ctrl+Tab");
|
||||
public string AutoCompleteHotkey2 => VerifyOrSetDefaultHotkey(Settings.AutoCompleteHotkey2, "");
|
||||
public string SelectNextItemHotkey => VerifyOrSetDefaultHotkey(Settings.SelectNextItemHotkey, "Tab");
|
||||
public string SelectNextItemHotkey2 => VerifyOrSetDefaultHotkey(Settings.SelectNextItemHotkey2, "");
|
||||
public string SelectPrevItemHotkey => VerifyOrSetDefaultHotkey(Settings.SelectPrevItemHotkey, "Shift+Tab");
|
||||
public string SelectPrevItemHotkey2 => VerifyOrSetDefaultHotkey(Settings.SelectPrevItemHotkey2, "");
|
||||
public string SelectNextPageHotkey => VerifyOrSetDefaultHotkey(Settings.SelectNextPageHotkey, "");
|
||||
public string SelectPrevPageHotkey => VerifyOrSetDefaultHotkey(Settings.SelectPrevPageHotkey, "");
|
||||
public string OpenContextMenuHotkey => VerifyOrSetDefaultHotkey(Settings.OpenContextMenuHotkey, "Ctrl+O");
|
||||
public string SettingWindowHotkey => VerifyOrSetDefaultHotkey(Settings.SettingWindowHotkey, "Ctrl+I");
|
||||
|
||||
|
||||
public string Image => Constant.QueryTextBoxIconImagePath;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,11 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedIndex = NewIndex(0);
|
||||
}
|
||||
|
||||
public void SelectLastResult()
|
||||
{
|
||||
SelectedIndex = NewIndex(Results.Count - 1);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (_collectionLock)
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ using Flow.Launcher.Plugin.SharedModels;
|
|||
using System.Collections.ObjectModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Flow.Launcher.Infrastructure.Hotkey;
|
||||
|
||||
namespace Flow.Launcher.ViewModel
|
||||
{
|
||||
|
|
@ -68,7 +70,12 @@ namespace Flow.Launcher.ViewModel
|
|||
break;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
public void SetTogglingHotkey(HotkeyModel hotkey)
|
||||
{
|
||||
HotKeyMapper.SetHotkey(hotkey, HotKeyMapper.OnToggleHotkey);
|
||||
}
|
||||
|
||||
public Settings Settings { get; set; }
|
||||
|
|
@ -110,13 +117,15 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("setAutoStartFailed"), e.Message);
|
||||
Notification.Show(InternationalizationManager.Instance.GetTranslation("setAutoStartFailed"),
|
||||
e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This is only required to set at startup. When portable mode enabled/disabled a restart is always required
|
||||
private bool _portableMode = DataLocation.PortableDataLocationInUse();
|
||||
|
||||
public bool PortableMode
|
||||
{
|
||||
get => _portableMode;
|
||||
|
|
@ -185,6 +194,7 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
|
||||
private List<LastQueryMode> _lastQueryModes = new List<LastQueryMode>();
|
||||
|
||||
public List<LastQueryMode> LastQueryModes
|
||||
{
|
||||
get
|
||||
|
|
@ -193,6 +203,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
_lastQueryModes = InitLastQueryModes();
|
||||
}
|
||||
|
||||
return _lastQueryModes;
|
||||
}
|
||||
}
|
||||
|
|
@ -200,17 +211,16 @@ namespace Flow.Launcher.ViewModel
|
|||
private List<LastQueryMode> InitLastQueryModes()
|
||||
{
|
||||
var modes = new List<LastQueryMode>();
|
||||
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(typeof(Infrastructure.UserSettings.LastQueryMode));
|
||||
var enums = (Infrastructure.UserSettings.LastQueryMode[])Enum.GetValues(
|
||||
typeof(Infrastructure.UserSettings.LastQueryMode));
|
||||
foreach (var e in enums)
|
||||
{
|
||||
var key = $"LastQuery{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new LastQueryMode
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
var m = new LastQueryMode { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
|
||||
|
|
@ -267,15 +277,15 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
public List<string> OpenResultModifiersList => new List<string>
|
||||
{
|
||||
KeyConstant.Alt,
|
||||
KeyConstant.Ctrl,
|
||||
$"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
||||
KeyConstant.Alt, KeyConstant.Ctrl, $"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
||||
};
|
||||
|
||||
private Internationalization _translater => InternationalizationManager.Instance;
|
||||
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||
|
||||
public string AlwaysPreviewToolTip => string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
|
||||
public string AlwaysPreviewToolTip =>
|
||||
string.Format(_translater.GetTranslation("AlwaysPreviewToolTip"), Settings.PreviewHotkey);
|
||||
|
||||
public string TestProxy()
|
||||
{
|
||||
|
|
@ -285,6 +295,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty");
|
||||
}
|
||||
|
||||
if (Settings.Proxy.Port <= 0)
|
||||
{
|
||||
return InternationalizationManager.Instance.GetTranslation("portCantBeEmpty");
|
||||
|
|
@ -303,6 +314,7 @@ namespace Flow.Launcher.ViewModel
|
|||
Credentials = new NetworkCredential(proxyUserName, Settings.Proxy.Password)
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var response = (HttpWebResponse)request.GetResponse();
|
||||
|
|
@ -333,10 +345,7 @@ namespace Flow.Launcher.ViewModel
|
|||
get => PluginManager.AllPlugins
|
||||
.OrderBy(x => x.Metadata.Disabled)
|
||||
.ThenBy(y => y.Metadata.Name)
|
||||
.Select(p => new PluginViewModel
|
||||
{
|
||||
PluginPair = p
|
||||
})
|
||||
.Select(p => new PluginViewModel { PluginPair = p })
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
|
@ -383,8 +392,7 @@ namespace Flow.Launcher.ViewModel
|
|||
await PluginsManifest.UpdateManifestAsync();
|
||||
OnPropertyChanged(nameof(ExternalPlugins));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
internal void DisplayPluginQuery(string queryToDisplay, PluginPair plugin, int actionKeywordPosition = 0)
|
||||
{
|
||||
|
|
@ -458,12 +466,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"ColorScheme{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new ColorScheme
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
var m = new ColorScheme { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
|
@ -484,13 +490,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"SearchWindowScreen{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new SearchWindowScreen
|
||||
{
|
||||
Display = display,
|
||||
Value = e,
|
||||
};
|
||||
var m = new SearchWindowScreen { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
|
@ -511,12 +514,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"SearchWindowAlign{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new SearchWindowAlign
|
||||
{
|
||||
Display = display, Value = e,
|
||||
};
|
||||
var m = new SearchWindowAlign { Display = display, Value = e, };
|
||||
modes.Add(m);
|
||||
}
|
||||
|
||||
return modes;
|
||||
}
|
||||
}
|
||||
|
|
@ -531,6 +532,7 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
screenNumbers.Add(i);
|
||||
}
|
||||
|
||||
return screenNumbers;
|
||||
}
|
||||
}
|
||||
|
|
@ -617,13 +619,10 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var key = $"AnimationSpeed{e}";
|
||||
var display = _translater.GetTranslation(key);
|
||||
var m = new AnimationSpeed
|
||||
{
|
||||
Display = display,
|
||||
Value = e,
|
||||
};
|
||||
var m = new AnimationSpeed { Display = display, Value = e, };
|
||||
speeds.Add(m);
|
||||
}
|
||||
|
||||
return speeds;
|
||||
}
|
||||
}
|
||||
|
|
@ -690,10 +689,7 @@ namespace Flow.Launcher.ViewModel
|
|||
bitmap.DecodePixelWidth = 800;
|
||||
bitmap.DecodePixelHeight = 600;
|
||||
bitmap.EndInit();
|
||||
var brush = new ImageBrush(bitmap)
|
||||
{
|
||||
Stretch = Stretch.UniformToFill
|
||||
};
|
||||
var brush = new ImageBrush(bitmap) { Stretch = Stretch.UniformToFill };
|
||||
return brush;
|
||||
}
|
||||
else
|
||||
|
|
@ -714,26 +710,36 @@ namespace Flow.Launcher.ViewModel
|
|||
new Result
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("SampleTitleExplorer"),
|
||||
SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleExplorer"),
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.Explorer\Images\explorer.png")
|
||||
SubTitle =
|
||||
InternationalizationManager.Instance.GetTranslation("SampleSubTitleExplorer"),
|
||||
IcoPath =
|
||||
Path.Combine(Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.Explorer\Images\explorer.png")
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("SampleTitleWebSearch"),
|
||||
SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleWebSearch"),
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png")
|
||||
SubTitle =
|
||||
InternationalizationManager.Instance.GetTranslation("SampleSubTitleWebSearch"),
|
||||
IcoPath =
|
||||
Path.Combine(Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.WebSearch\Images\web_search.png")
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("SampleTitleProgram"),
|
||||
SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleProgram"),
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.Program\Images\program.png")
|
||||
IcoPath =
|
||||
Path.Combine(Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.Program\Images\program.png")
|
||||
},
|
||||
new Result
|
||||
{
|
||||
Title = InternationalizationManager.Instance.GetTranslation("SampleTitleProcessKiller"),
|
||||
SubTitle = InternationalizationManager.Instance.GetTranslation("SampleSubTitleProcessKiller"),
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory, @"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
||||
SubTitle =
|
||||
InternationalizationManager.Instance.GetTranslation("SampleSubTitleProcessKiller"),
|
||||
IcoPath = Path.Combine(Constant.ProgramDirectory,
|
||||
@"Plugins\Flow.Launcher.Plugin.ProcessKiller\Images\app.png")
|
||||
}
|
||||
};
|
||||
var vm = new ResultsViewModel(Settings);
|
||||
|
|
@ -889,6 +895,7 @@ namespace Flow.Launcher.ViewModel
|
|||
SelectedCustomShortcut = item;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -917,6 +924,7 @@ namespace Flow.Launcher.ViewModel
|
|||
public string Documentation => Constant.Documentation;
|
||||
public string Docs => Constant.Docs;
|
||||
public string Github => Constant.GitHub;
|
||||
|
||||
public string Version
|
||||
{
|
||||
get
|
||||
|
|
@ -931,7 +939,9 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
}
|
||||
public string ActivatedTimes => string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||
|
||||
public string ActivatedTimes =>
|
||||
string.Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||
|
||||
public string CheckLogFolder
|
||||
{
|
||||
|
|
@ -939,7 +949,8 @@ namespace Flow.Launcher.ViewModel
|
|||
{
|
||||
var logFiles = GetLogFiles();
|
||||
long size = logFiles.Sum(file => file.Length);
|
||||
return string.Format("{0} ({1})", _translater.GetTranslation("clearlogfolder"), BytesToReadableString(size));
|
||||
return string.Format("{0} ({1})", _translater.GetTranslation("clearlogfolder"),
|
||||
BytesToReadableString(size));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -976,10 +987,7 @@ namespace Flow.Launcher.ViewModel
|
|||
internal static string BytesToReadableString(long bytes)
|
||||
{
|
||||
const int scale = 1024;
|
||||
string[] orders = new string[]
|
||||
{
|
||||
"GB", "MB", "KB", "B"
|
||||
};
|
||||
string[] orders = new string[] { "GB", "MB", "KB", "B" };
|
||||
long max = (long)Math.Pow(scale, orders.Length - 1);
|
||||
|
||||
foreach (string order in orders)
|
||||
|
|
@ -989,6 +997,7 @@ namespace Flow.Launcher.ViewModel
|
|||
|
||||
max /= scale;
|
||||
}
|
||||
|
||||
return "0 B";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@
|
|||
Title="{DynamicResource Welcome_Page1_Title}"
|
||||
Width="550"
|
||||
Height="650"
|
||||
MinWidth="550"
|
||||
MinHeight="650"
|
||||
MaxWidth="550"
|
||||
MaxHeight="650"
|
||||
Activated="OnActivated"
|
||||
Background="{DynamicResource Color00B}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
|
|
|
|||
Loading…
Reference in a new issue