From 016f92ad9990b5fd8dbe5306213b9a2ab9a8c415 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 18 Nov 2022 01:49:25 +0900 Subject: [PATCH] Adjust Context Menus / Adjust Colors (with hotkey menu) / Add Hotkey Register String --- Flow.Launcher/HotkeyControl.xaml | 9 +- Flow.Launcher/HotkeyControl.xaml.cs | 3 +- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/MainWindow.xaml | 235 ++++---- Flow.Launcher/MainWindow.xaml.cs | 39 +- .../Resources/CustomControlTemplate.xaml | 533 ++++++++++++++++-- Flow.Launcher/SettingWindow.xaml | 124 ++-- 7 files changed, 694 insertions(+), 250 deletions(-) diff --git a/Flow.Launcher/HotkeyControl.xaml b/Flow.Launcher/HotkeyControl.xaml index 9b5f671d8..5a593d20a 100644 --- a/Flow.Launcher/HotkeyControl.xaml +++ b/Flow.Launcher/HotkeyControl.xaml @@ -38,9 +38,8 @@ FontSize="13" FontWeight="SemiBold" Foreground="{DynamicResource Color05B}" - Visibility="Visible"> - Press key - + Text="{DynamicResource flowlauncherPressHotkey}" + Visibility="Visible" /> @@ -49,8 +48,8 @@ Margin="0,0,18,0" VerticalContentAlignment="Center" input:InputMethod.IsInputMethodEnabled="False" + LostFocus="tbHotkey_LostFocus" PreviewKeyDown="TbHotkey_OnPreviewKeyDown" - TabIndex="100" - LostFocus="tbHotkey_LostFocus"/> + TabIndex="100" /> \ No newline at end of file diff --git a/Flow.Launcher/HotkeyControl.xaml.cs b/Flow.Launcher/HotkeyControl.xaml.cs index 7e07695d8..d746c8fd2 100644 --- a/Flow.Launcher/HotkeyControl.xaml.cs +++ b/Flow.Launcher/HotkeyControl.xaml.cs @@ -9,6 +9,7 @@ using Flow.Launcher.Helper; using Flow.Launcher.Infrastructure.Hotkey; using Flow.Launcher.Plugin; using System.Threading; +using System.Windows.Interop; namespace Flow.Launcher { @@ -113,7 +114,7 @@ namespace Flow.Launcher private void tbHotkey_LostFocus(object sender, RoutedEventArgs e) { tbMsg.Text = tbMsgTextOriginal; - tbMsg.Foreground = tbMsgForegroundColorOriginal; + tbMsg.SetResourceReference(TextBox.ForegroundProperty, "Color05B"); } } } diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 1a161a19e..9d21a5d5c 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -164,6 +164,7 @@ You can also quickly adjust this by using Ctrl+[ and Ctrl+]. Use Segoe Fluent Icons Use Segoe Fluent Icons for query results where supported + Press Key HTTP Proxy diff --git a/Flow.Launcher/MainWindow.xaml b/Flow.Launcher/MainWindow.xaml index 922f8b933..db798087f 100644 --- a/Flow.Launcher/MainWindow.xaml +++ b/Flow.Launcher/MainWindow.xaml @@ -1,4 +1,5 @@ - - - - - - + + + + - - - - - - - - - - - + + - - - - + - - - - - - - - - - - - + - - - - + + + - - + - - - - + + + + + + + + + + + + + + + - - + + - + - + Text="{Binding DateText}" + Visibility="{Binding Settings.UseDate, Converter={StaticResource BooleanToVisibilityConverter}}" /> + - - - - - - - + + + - @@ -306,16 +327,14 @@ - - - + + + - @@ -323,16 +342,14 @@ - - - + + + - diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 6a65a38f2..7095ed24f 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.ComponentModel; using System.Threading.Tasks; using System.Windows; @@ -27,6 +27,9 @@ using Microsoft.AspNetCore.Http; using System.IO; using System.Windows.Threading; using System.Windows.Data; +using ModernWpf.Controls; +using System.Drawing; +using System.Windows.Forms.Design.Behavior; namespace Flow.Launcher { @@ -224,11 +227,12 @@ namespace Flow.Launcher private void UpdateNotifyIconText() { var menu = contextMenu; - ((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")"; - ((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("GameMode"); - ((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset"); - ((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"); - ((MenuItem)menu.Items[5]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"); + ((MenuItem)menu.Items[0]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")"; + ((MenuItem)menu.Items[1]).Header = InternationalizationManager.Instance.GetTranslation("GameMode"); + ((MenuItem)menu.Items[2]).Header = InternationalizationManager.Instance.GetTranslation("PositionReset"); + ((MenuItem)menu.Items[3]).Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"); + ((MenuItem)menu.Items[4]).Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"); + } private void InitializeNotifyIcon() @@ -240,31 +244,33 @@ namespace Flow.Launcher Visible = !_settings.HideNotifyIcon }; contextMenu = new ContextMenu(); - - var header = new MenuItem - { - Header = "Flow Launcher", - IsEnabled = false - }; + var openIcon = new FontIcon { Glyph = "\ue71e" }; var open = new MenuItem { - Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" +_settings.Hotkey + ")" + Header = InternationalizationManager.Instance.GetTranslation("iconTrayOpen") + " (" + _settings.Hotkey + ")", + Icon = openIcon }; + var gamemodeIcon = new FontIcon { Glyph = "\ue7fc" }; var gamemode = new MenuItem { - Header = InternationalizationManager.Instance.GetTranslation("GameMode") + Header = InternationalizationManager.Instance.GetTranslation("GameMode"), + Icon = gamemodeIcon }; var positionreset = new MenuItem { Header = InternationalizationManager.Instance.GetTranslation("PositionReset") }; + var settingsIcon = new FontIcon { Glyph = "\ue713" }; var settings = new MenuItem { - Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings") + Header = InternationalizationManager.Instance.GetTranslation("iconTraySettings"), + Icon = settingsIcon }; + var exitIcon = new FontIcon { Glyph = "\ue7e8" }; var exit = new MenuItem { - Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit") + Header = InternationalizationManager.Instance.GetTranslation("iconTrayExit"), + Icon = exitIcon }; open.Click += (o, e) => _viewModel.ToggleFlowLauncher(); @@ -272,7 +278,6 @@ namespace Flow.Launcher positionreset.Click += (o, e) => PositionReset(); settings.Click += (o, e) => App.API.OpenSettingDialog(); exit.Click += (o, e) => Close(); - contextMenu.Items.Add(header); contextMenu.Items.Add(open); gamemode.ToolTip = InternationalizationManager.Instance.GetTranslation("GameModeToolTip"); positionreset.ToolTip = InternationalizationManager.Instance.GetTranslation("PositionResetToolTip"); diff --git a/Flow.Launcher/Resources/CustomControlTemplate.xaml b/Flow.Launcher/Resources/CustomControlTemplate.xaml index 6e8294031..70fe02c95 100644 --- a/Flow.Launcher/Resources/CustomControlTemplate.xaml +++ b/Flow.Launcher/Resources/CustomControlTemplate.xaml @@ -2727,73 +2727,491 @@ - + + - + + + + + diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 50f63edfe..636d2d4cd 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2361,7 +2361,7 @@ TextAlignment="left" /> - + @@ -2814,54 +2814,54 @@ Style="{DynamicResource PageTitle}" Text="{DynamicResource about}" TextAlignment="left" /> - - - - - - - - - + + - + + -  +  + -