Upload via GUI (186 Dateien)
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace DeskCore;
|
||||
|
||||
/// <summary>Einstellungen der Schnellstart-Suche.</summary>
|
||||
public partial class MainWindow
|
||||
{
|
||||
private void LoadQuickSearchSettings()
|
||||
{
|
||||
QuickSearchToggle.IsChecked = S.QuickSearchEnabled;
|
||||
QuickSearchHotkeyBox.Text = Hotkey.Describe(S.QuickSearchModifiers, S.QuickSearchKey);
|
||||
QuickSearchHotkeyBox.IsEnabled = S.QuickSearchEnabled;
|
||||
QuickSearchStartMenuBox.IsChecked = S.QuickSearchStartMenu;
|
||||
UpdateQuickSearchHint(App.QuickSearchRegistered);
|
||||
}
|
||||
|
||||
private void QuickSearchToggle_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
S.QuickSearchEnabled = QuickSearchToggle.IsChecked == true;
|
||||
S.Save();
|
||||
App.ApplyQuickSearchHotkey();
|
||||
LoadQuickSearchSettings();
|
||||
}
|
||||
|
||||
private void QuickSearchStartMenu_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
S.QuickSearchStartMenu = QuickSearchStartMenuBox.IsChecked == true;
|
||||
S.Save();
|
||||
}
|
||||
|
||||
private void QuickSearchHotkeyBox_PreviewKeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
var key = e.Key == Key.System ? e.SystemKey : e.Key;
|
||||
if (key is Key.Tab) return;
|
||||
e.Handled = true;
|
||||
if (key is Key.LeftCtrl or Key.RightCtrl or Key.LeftAlt or Key.RightAlt or Key.LeftShift or Key.RightShift
|
||||
or Key.LWin or Key.RWin or Key.Escape) return;
|
||||
|
||||
int mods = (int)Keyboard.Modifiers; // Alt=1, Strg=2, Umschalt=4, Win=8 – gleiche Bits wie RegisterHotKey
|
||||
if ((mods & (Hotkey.ModCtrl | Hotkey.ModAlt | Hotkey.ModWin)) == 0)
|
||||
{
|
||||
QuickSearchHint.Text = "Bitte mit Strg, Alt oder Win kombinieren.";
|
||||
return;
|
||||
}
|
||||
S.QuickSearchModifiers = mods;
|
||||
S.QuickSearchKey = KeyInterop.VirtualKeyFromKey(key);
|
||||
S.Save();
|
||||
QuickSearchHotkeyBox.Text = Hotkey.Describe(S.QuickSearchModifiers, S.QuickSearchKey);
|
||||
UpdateQuickSearchHint(App.ApplyQuickSearchHotkey());
|
||||
}
|
||||
|
||||
private void UpdateQuickSearchHint(bool ok) =>
|
||||
QuickSearchHint.Text = !S.QuickSearchEnabled ? "Ausgeschaltet"
|
||||
: ok ? $"{Hotkey.Describe(S.QuickSearchModifiers, S.QuickSearchKey)} öffnet von überall eine Suchleiste: ein paar Buchstaben tippen, Enter – fertig. " +
|
||||
"Was du oft startest, steht weiter oben."
|
||||
: "⚠ Diese Kombination ist schon von einem anderen Programm belegt – bitte ins Feld klicken und eine andere drücken.";
|
||||
}
|
||||
Reference in New Issue
Block a user