Flow.Launcher/Flow.Launcher/ViewModel/SettingWindowViewModel.cs

67 lines
1.6 KiB
C#
Raw Normal View History

using CommunityToolkit.Mvvm.DependencyInjection;
using Flow.Launcher.Core;
2020-04-21 09:12:17 +00:00
using Flow.Launcher.Core.Configuration;
using Flow.Launcher.Infrastructure.UserSettings;
using Flow.Launcher.Plugin;
2016-05-21 21:44:27 +00:00
namespace Flow.Launcher.ViewModel;
public class SettingWindowViewModel : BaseModel
{
public Updater Updater { get; private set; }
2022-09-27 06:44:00 +00:00
public IPortable Portable { get; private set; }
public Settings Settings { get; }
public SettingWindowViewModel()
{
Settings = Ioc.Default.GetRequiredService<Settings>();
}
public void Initialize()
{
// We don not initialize Updater and Portable in the constructor because we want to avoid
// recrusive dependency injection
Updater = Ioc.Default.GetRequiredService<Updater>();
Portable = Ioc.Default.GetRequiredService<Portable>();
}
public async void UpdateApp()
{
await Updater.UpdateAppAsync(App.API, false);
}
/// <summary>
/// Save Flow settings. Plugins settings are not included.
/// </summary>
public void Save()
{
2025-01-12 10:44:52 +00:00
Settings.Save();
}
2022-09-27 06:44:00 +00:00
public double SettingWindowWidth
{
get => Settings.SettingWindowWidth;
set => Settings.SettingWindowWidth = value;
}
2022-09-27 06:44:00 +00:00
public double SettingWindowHeight
{
get => Settings.SettingWindowHeight;
set => Settings.SettingWindowHeight = value;
}
2024-05-29 09:16:35 +00:00
public double? SettingWindowTop
{
get => Settings.SettingWindowTop;
set => Settings.SettingWindowTop = value;
}
2024-05-29 09:16:35 +00:00
public double? SettingWindowLeft
{
get => Settings.SettingWindowLeft;
set => Settings.SettingWindowLeft = value;
2016-05-21 21:44:27 +00:00
}
2016-11-20 20:01:47 +00:00
}