0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 09:50:43 -05:00
2023-03-03 19:25:33 +00:00

73 lines
2.0 KiB
C#

/* EditionCollection.cs
* License: NCSA Open Source License
*
* Copyright: Merijn Hendriks
* AUTHORS:
* Merijn Hendriks
*/
using System.Collections.ObjectModel;
using System.ComponentModel;
namespace Aki.Launcher.Models.Launcher
{
public class EditionCollection : INotifyPropertyChanged
{
private bool _HasSelection;
public bool HasSelection
{
get => _HasSelection;
set
{
if(_HasSelection != value)
{
_HasSelection = value;
RaisePropertyChanged(nameof(HasSelection));
}
}
}
private int _SelectedEditionIndex;
public int SelectedEditionIndex
{
get => _SelectedEditionIndex;
set
{
if (_SelectedEditionIndex != value)
{
_SelectedEditionIndex = value;
RaisePropertyChanged(nameof(SelectedEditionIndex));
}
}
}
private string _SelectedEdition;
public string SelectedEdition
{
get => _SelectedEdition;
set
{
if (_SelectedEdition != value)
{
_SelectedEdition = value;
HasSelection = _SelectedEdition != null;
RaisePropertyChanged(nameof(SelectedEdition));
}
}
}
public ObservableCollection<string> AvailableEditions { get; private set; } = new ObservableCollection<string>(ServerManager.SelectedServer.editions);
public EditionCollection()
{
SelectedEditionIndex = 0;
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void RaisePropertyChanged(string property)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}
}
}