mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Revert changes and use api function instead
This commit is contained in:
parent
0611340d71
commit
6b032b3352
6 changed files with 14 additions and 25 deletions
|
|
@ -7,7 +7,6 @@ using System.Windows;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Controls;
|
||||
using Flow.Launcher.Core;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -15,15 +14,13 @@ namespace Flow.Launcher
|
|||
{
|
||||
private SettingWindow _settingWidow;
|
||||
private readonly Settings _settings;
|
||||
private readonly MainViewModel _mainViewModel;
|
||||
private bool update;
|
||||
private CustomPluginHotkey updateCustomHotkey;
|
||||
|
||||
public CustomQueryHotkeySetting(SettingWindow settingWidow, Settings settings, MainViewModel mainVM)
|
||||
public CustomQueryHotkeySetting(SettingWindow settingWidow, Settings settings)
|
||||
{
|
||||
_settingWidow = settingWidow;
|
||||
_settings = settings;
|
||||
_mainViewModel = mainVM;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
@ -80,7 +77,7 @@ namespace Flow.Launcher
|
|||
private void BtnTestActionKeyword_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.API.ChangeQuery(tbAction.Text);
|
||||
_mainViewModel.Show();
|
||||
App.API.ShowMainWindow();
|
||||
Application.Current.MainWindow.Focus();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,24 +4,21 @@ using System.Windows;
|
|||
using System.Windows.Input;
|
||||
using Flow.Launcher.SettingPages.ViewModels;
|
||||
using Flow.Launcher.Core;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
public partial class CustomShortcutSetting : Window
|
||||
{
|
||||
private readonly SettingsPaneHotkeyViewModel _hotkeyVm;
|
||||
private readonly MainViewModel _mainViewModel;
|
||||
public string Key { get; set; } = String.Empty;
|
||||
public string Value { get; set; } = String.Empty;
|
||||
private string originalKey { get; } = null;
|
||||
private string originalValue { get; } = null;
|
||||
private bool update { get; } = false;
|
||||
|
||||
public CustomShortcutSetting(SettingsPaneHotkeyViewModel vm, MainViewModel mainVM)
|
||||
public CustomShortcutSetting(SettingsPaneHotkeyViewModel vm)
|
||||
{
|
||||
_hotkeyVm = vm;
|
||||
_mainViewModel = mainVM;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +65,7 @@ namespace Flow.Launcher
|
|||
private void BtnTestShortcut_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
App.API.ChangeQuery(tbExpand.Text);
|
||||
_mainViewModel.Show();
|
||||
App.API.ShowMainWindow();
|
||||
Application.Current.MainWindow.Focus();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ namespace Flow.Launcher
|
|||
{
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
SettingWindow sw = SingletonWindowOpener.Open<SettingWindow>(this, _settingsVM, _mainVM);
|
||||
SettingWindow sw = SingletonWindowOpener.Open<SettingWindow>(this, _settingsVM);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,14 +8,12 @@ using Flow.Launcher.Infrastructure.Hotkey;
|
|||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Flow.Launcher.Plugin;
|
||||
using Flow.Launcher.Core;
|
||||
using Flow.Launcher.ViewModel;
|
||||
|
||||
namespace Flow.Launcher.SettingPages.ViewModels;
|
||||
|
||||
public partial class SettingsPaneHotkeyViewModel : BaseModel
|
||||
{
|
||||
public Settings Settings { get; }
|
||||
private MainViewModel MainVM { get; }
|
||||
|
||||
public CustomPluginHotkey SelectedCustomPluginHotkey { get; set; }
|
||||
public CustomShortcutModel SelectedCustomShortcut { get; set; }
|
||||
|
|
@ -27,10 +25,9 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
$"{KeyConstant.Ctrl}+{KeyConstant.Alt}"
|
||||
};
|
||||
|
||||
public SettingsPaneHotkeyViewModel(Settings settings, MainViewModel mainVM)
|
||||
public SettingsPaneHotkeyViewModel(Settings settings)
|
||||
{
|
||||
Settings = settings;
|
||||
MainVM = mainVM;
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
|
@ -74,7 +71,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
return;
|
||||
}
|
||||
|
||||
var window = new CustomQueryHotkeySetting(null, Settings, MainVM);
|
||||
var window = new CustomQueryHotkeySetting(null, Settings);
|
||||
window.UpdateItem(item);
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
|
@ -82,7 +79,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
[RelayCommand]
|
||||
private void CustomHotkeyAdd()
|
||||
{
|
||||
new CustomQueryHotkeySetting(null, Settings, MainVM).ShowDialog();
|
||||
new CustomQueryHotkeySetting(null, Settings).ShowDialog();
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
|
|
@ -129,7 +126,7 @@ public partial class SettingsPaneHotkeyViewModel : BaseModel
|
|||
[RelayCommand]
|
||||
private void CustomShortcutAdd()
|
||||
{
|
||||
var window = new CustomShortcutSetting(this, MainVM);
|
||||
var window = new CustomShortcutSetting(this);
|
||||
if (window.ShowDialog() is true)
|
||||
{
|
||||
var shortcut = new CustomShortcutModel(window.Key, window.Value);
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ public partial class SettingsPaneHotkey
|
|||
{
|
||||
if (!IsInitialized)
|
||||
{
|
||||
if (e.ExtraData is not SettingWindow.PaneData { Settings: { } settings, MainViewModel: { } mainVM })
|
||||
if (e.ExtraData is not SettingWindow.PaneData { Settings: { } settings })
|
||||
throw new ArgumentException("Settings are required for SettingsPaneHotkey.");
|
||||
_viewModel = new SettingsPaneHotkeyViewModel(settings, mainVM);
|
||||
_viewModel = new SettingsPaneHotkeyViewModel(settings);
|
||||
DataContext = _viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,14 +20,12 @@ public partial class SettingWindow
|
|||
private readonly IPublicAPI _api;
|
||||
private readonly Settings _settings;
|
||||
private readonly SettingWindowViewModel _viewModel;
|
||||
private readonly MainViewModel _mainVM;
|
||||
|
||||
public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel, MainViewModel mainVM)
|
||||
public SettingWindow(IPublicAPI api, SettingWindowViewModel viewModel)
|
||||
{
|
||||
_settings = viewModel.Settings;
|
||||
DataContext = viewModel;
|
||||
_viewModel = viewModel;
|
||||
_mainVM = mainVM;
|
||||
_api = api;
|
||||
InitializePosition();
|
||||
InitializeComponent();
|
||||
|
|
@ -162,7 +160,7 @@ public partial class SettingWindow
|
|||
|
||||
private void NavigationView_SelectionChanged(NavigationView sender, NavigationViewSelectionChangedEventArgs args)
|
||||
{
|
||||
var paneData = new PaneData(_settings, _viewModel.Updater, _viewModel.Portable, _mainVM);
|
||||
var paneData = new PaneData(_settings, _viewModel.Updater, _viewModel.Portable);
|
||||
if (args.IsSettingsSelected)
|
||||
{
|
||||
ContentFrame.Navigate(typeof(SettingsPaneGeneral), paneData);
|
||||
|
|
@ -208,5 +206,5 @@ public partial class SettingWindow
|
|||
NavView.SelectedItem ??= NavView.MenuItems[0]; /* Set First Page */
|
||||
}
|
||||
|
||||
public record PaneData(Settings Settings, Updater Updater, IPortable Portable, MainViewModel MainViewModel);
|
||||
public record PaneData(Settings Settings, Updater Updater, IPortable Portable);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue