From a62b67e0b716bde6d9713cdd9d1a22138a7c27a6 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 18 Apr 2024 00:32:10 +0900 Subject: [PATCH] Added Hotkey Display Control --- .../Resources/Controls/HotkeyDisplay.xaml | 61 ++++++++++++++++++- .../Resources/Controls/HotkeyDisplay.xaml.cs | 25 +++++++- Flow.Launcher/SettingWindow.xaml | 4 +- 3 files changed, 85 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml index 269f095f3..d4483393d 100644 --- a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml +++ b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml @@ -9,7 +9,62 @@ d:DesignWidth="800" mc:Ignorable="d"> - + + + + + + + + diff --git a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs index d83b44fac..3549647aa 100644 --- a/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs +++ b/Flow.Launcher/Resources/Controls/HotkeyDisplay.xaml.cs @@ -1,5 +1,8 @@ using System; +using System.Collections; using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Diagnostics; using System.Globalization; using System.Linq; using System.Text; @@ -13,6 +16,9 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Windows.Media.Capture.Frames; +using static System.Windows.Forms.LinkLabel; +using static ABI.System.Collections.Generic.IReadOnlyDictionary_Delegates; namespace Flow.Launcher.Resources.Controls { @@ -21,6 +27,9 @@ namespace Flow.Launcher.Resources.Controls public HotkeyDisplay() { InitializeComponent(); + //List stringList =e.NewValue.Split('+').ToList(); + KeysControl.ItemsSource = Values; + } public string Keys @@ -29,6 +38,20 @@ namespace Flow.Launcher.Resources.Controls set { SetValue(KeysValueProperty, value); } } public static readonly DependencyProperty KeysValueProperty = - DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay), new PropertyMetadata(string.Empty)); + DependencyProperty.Register("Keys", typeof(string), typeof(HotkeyDisplay), new PropertyMetadata(string.Empty, valueChanged)); + + private static void valueChanged(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; + + //String[] Values = newValue.Split('+'); + //Debug.WriteLine(Values[0]); + } + + public ObservableCollection Values { get; set; } } } diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 064e86382..1beafd26b 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2729,7 +2729,9 @@ Title="{DynamicResource flowlauncherHotkey}" Icon="" Sub="{DynamicResource flowlauncherHotkeyToolTip}" - Type="Inside" /> + Type="Inside"> + +