Files
Nebula-Auth/NebulaAuth/ViewModel/Other/SettingsVM.cs
T
achiez 8ff960189e 1.5.6 Bug fixes and code clean-ups
- Update: Added "Copy Password" to Mafile context menu (if available)
- Update: "Save Password" now pre-fills the current password in the "Login Again" dialog when encryption is enabled
- Fix: Prevented overlapping confirmation cycles in AutoConfirmer
- Fix: Added a Snackbar notification when a confirmation cycle is skipped due to a too frequent timer interval
- Fix: Fixed a rare bug where the previous proxy was used instead of the current one during session refresh
- Fix: Corrected "Session Permanently Expired" message showing on unrelated errors (e.g. network issues)
- UI-Fix: Fixed visual glitch where proxy input appeared non-empty when switching to a mafile-specific proxy
- Cleanup: Refactored and cleaned up codebase, improved styling and formatting via ReSharper
2025-05-02 23:29:24 +03:00

125 lines
3.1 KiB
C#

using System.Collections.Generic;
using System.Windows.Media;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using NebulaAuth.Core;
using NebulaAuth.Model;
namespace NebulaAuth.ViewModel.Other;
public partial class SettingsVM : ObservableObject
{
public Settings Settings => Settings.Instance;
public BackgroundMode BackgroundMode
{
get => Settings.BackgroundMode;
set => Settings.BackgroundMode = value;
}
public bool HideToTray
{
get => Settings.HideToTray;
set => Settings.HideToTray = value;
}
public Dictionary<BackgroundMode, string> BackgroundModes => new()
{
{BackgroundMode.Default, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "Default")},
{BackgroundMode.Custom, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "Custom")},
{BackgroundMode.Color, LocManager.GetOrDefault("Default", "SettingsDialog", "BackgroundMode", "NoBackground")}
};
public Dictionary<LocalizationLanguage, string> Languages { get; } = new()
{
{LocalizationLanguage.English, "English"},
{LocalizationLanguage.Russian, "Русский"},
{LocalizationLanguage.Ukrainian, "Українська"}
};
public Color? BackgroundColor
{
get => Settings.BackgroundColor;
set => Settings.BackgroundColor = value;
}
public Color? IconColor
{
get => Settings.IconColor;
set => Settings.IconColor = value;
}
public bool UseIcon
{
get => IconColor != null;
set
{
if (value == false)
IconColor = null;
else
IconColor = Color.FromRgb(202, 39, 39);
OnPropertyChanged();
OnPropertyChanged(nameof(IconColor));
}
}
public bool UseBackground
{
get => BackgroundColor != null;
set
{
if (value == false)
BackgroundColor = null;
else
BackgroundColor = Color.FromRgb(202, 39, 39);
OnPropertyChanged();
OnPropertyChanged(nameof(BackgroundColor));
}
}
public LocalizationLanguage Language
{
get => Settings.Language;
set
{
Settings.Language = value;
LocManager.SetApplicationLocalization(value);
}
}
public bool LegacyMode
{
get => Settings.LegacyMode;
set => Settings.LegacyMode = value;
}
public bool AllowAutoUpdate
{
get => Settings.AllowAutoUpdate;
set => Settings.AllowAutoUpdate = value;
}
public bool UseAccountNameAsMafileName
{
get => Settings.UseAccountNameAsMafileName;
set => Settings.UseAccountNameAsMafileName = value;
}
public bool IgnorePatchTuesdayErrors
{
get => Settings.IgnorePatchTuesdayErrors;
set => Settings.IgnorePatchTuesdayErrors = value;
}
[ObservableProperty] private string? _password;
[RelayCommand]
private void SetPassword()
{
Settings.IsPasswordSet = PHandler.SetPassword(Password);
}
}