0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 09:30:45 -05:00
loyvsc 441fb128fe Implement NotifyPropertyChangedBase, optimization (!66)
- NotifyPropertyChangedBase created and implemented in classes that inherit INotifyPropertyChangedBase
- Some optimization fixes in models (one of this - `Where(predicate).Count() == 0` to `All(invertedPredicate)`

Co-authored-by: Valery Varaksa <varaksav62@gmail.com>
Reviewed-on: SPT/Launcher#66
Co-authored-by: loyvsc <loyvsc@noreply.dev.sp-tarkov.com>
Co-committed-by: loyvsc <loyvsc@noreply.dev.sp-tarkov.com>
2024-09-02 07:53:58 +00:00

35 lines
963 B
C#

/* LocaleCollection.cs
* License: NCSA Open Source License
*
* Copyright: SPT
* AUTHORS:
* waffle.lord
*/
using SPT.Launcher.Helpers;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using SPT.Launcher.Utilities;
namespace SPT.Launcher.Models.Launcher
{
public class LocaleCollection : NotifyPropertyChangedBase
{
private string _selectedLocale;
public string SelectedLocale
{
get => _selectedLocale;
set => SetProperty(ref _selectedLocale, value, () => LocalizationProvider.LoadLocalByName(value));
}
public ObservableCollection<string> AvailableLocales { get; set; } = LocalizationProvider.GetAvailableLocales();
public LocaleCollection()
{
SelectedLocale = LocalizationProvider.LocaleNameDictionary.GetValueOrDefault(LauncherSettingsProvider.Instance.DefaultLocale, "English");
}
}
}