mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fully functional General pane in the settings window
This commit is contained in:
parent
2285040857
commit
3c54114bc9
4 changed files with 35 additions and 8 deletions
|
|
@ -13,7 +13,6 @@ using Flow.Launcher.Plugin.SharedModels;
|
|||
|
||||
namespace Flow.Launcher.SettingPages.ViewModels;
|
||||
|
||||
// TODO: _updater, _portable
|
||||
public partial class SettingsPaneGeneralViewModel
|
||||
{
|
||||
private static Internationalization Translator => InternationalizationManager.Instance;
|
||||
|
|
@ -22,9 +21,12 @@ public partial class SettingsPaneGeneralViewModel
|
|||
private readonly Updater _updater;
|
||||
private readonly IPortable _portable;
|
||||
|
||||
public SettingsPaneGeneralViewModel(Settings settings)
|
||||
public SettingsPaneGeneralViewModel(Settings settings, Updater updater, IPortable portable)
|
||||
{
|
||||
Settings = settings;
|
||||
_updater = updater;
|
||||
_portable = portable;
|
||||
UpdateLastQueryModeDisplay();
|
||||
}
|
||||
|
||||
public class SearchWindowScreen : DropdownDataGeneric<SearchWindowScreens> { }
|
||||
|
|
@ -181,6 +183,25 @@ public partial class SettingsPaneGeneralViewModel
|
|||
};
|
||||
}
|
||||
|
||||
private void UpdateApp()
|
||||
{
|
||||
_ = _updater.UpdateAppAsync(App.API, false);
|
||||
}
|
||||
|
||||
public bool AutoUpdates
|
||||
{
|
||||
get => Settings.AutoUpdates;
|
||||
set
|
||||
{
|
||||
Settings.AutoUpdates = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
UpdateApp();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[RelayCommand]
|
||||
private void SelectPython()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ public partial class SettingsPaneGeneral
|
|||
{
|
||||
if (!IsInitialized)
|
||||
{
|
||||
if (e.ExtraData is not Settings settings)
|
||||
throw new ArgumentException("Settings is not passed to General page");
|
||||
_viewModel = new SettingsPaneGeneralViewModel(settings);
|
||||
if (e.ExtraData is not SettingWindow.PaneData { Settings: { } settings, Updater: {} updater, Portable: {} portable })
|
||||
throw new ArgumentException("Settings, Updater and Portable are required for SettingsPaneGeneral.");
|
||||
_viewModel = new SettingsPaneGeneralViewModel(settings, updater, portable);
|
||||
DataContext = _viewModel;
|
||||
InitializeComponent();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@ using System.Windows.Forms;
|
|||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Navigation;
|
||||
using Flow.Launcher.Core;
|
||||
using Flow.Launcher.Core.Configuration;
|
||||
using NHotkey;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using Control = System.Windows.Controls.Control;
|
||||
|
|
@ -531,8 +533,9 @@ namespace Flow.Launcher
|
|||
nameof(About) => typeof(SettingsPaneAbout),
|
||||
_ => typeof(SettingsPaneGeneral)
|
||||
};
|
||||
ContentFrame.Navigate(pageType, settings);
|
||||
ContentFrame.Navigate(pageType, new PaneData(settings, viewModel.Updater, viewModel.Portable));
|
||||
}
|
||||
}
|
||||
public record PaneData(Settings Settings, Updater Updater, IPortable Portable);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,10 @@ namespace Flow.Launcher.ViewModel
|
|||
private readonly IPortable _portable;
|
||||
private readonly FlowLauncherJsonStorage<Settings> _storage;
|
||||
|
||||
/* For Navigation View */
|
||||
public Updater Updater => _updater;
|
||||
public IPortable Portable => _portable;
|
||||
|
||||
/* For Navigation View */
|
||||
private NavigationTransitionInfo _transitionInfo = new SlideNavigationTransitionInfo()
|
||||
{
|
||||
Effect = SlideNavigationTransitionEffect.FromBottom
|
||||
|
|
@ -152,7 +155,7 @@ namespace Flow.Launcher.ViewModel
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public string TestProxy()
|
||||
{
|
||||
var proxyServer = Settings.Proxy.Server;
|
||||
|
|
|
|||
Loading…
Reference in a new issue