0
0
mirror of https://github.com/sp-tarkov/launcher.git synced 2025-02-13 09:50:43 -05:00

78 lines
2.1 KiB
C#
Raw Normal View History

2023-03-03 19:25:33 +00:00
/* EditionCollection.cs
* License: NCSA Open Source License
*
2024-05-21 20:15:19 +01:00
* Copyright: SPT
2023-03-03 19:25:33 +00:00
* AUTHORS:
*/
2024-05-21 20:15:19 +01:00
using SPT.Launcher.Models.SPT;
2023-03-03 19:25:33 +00:00
using System.Collections.ObjectModel;
using System.ComponentModel;
2024-05-21 20:15:19 +01:00
namespace SPT.Launcher.Models.Launcher
2023-03-03 19:25:33 +00:00
{
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));
}
}
}
2024-05-21 20:15:19 +01:00
private SPTEdition _SelectedEdition;
public SPTEdition SelectedEdition
2023-03-03 19:25:33 +00:00
{
get => _SelectedEdition;
set
{
if (_SelectedEdition != value)
{
_SelectedEdition = value;
HasSelection = _SelectedEdition != null;
RaisePropertyChanged(nameof(SelectedEdition));
}
}
}
2024-05-21 20:15:19 +01:00
public ObservableCollection<SPTEdition> AvailableEditions { get; private set; } = new ObservableCollection<SPTEdition>();
2023-03-03 19:25:33 +00:00
public EditionCollection()
{
SelectedEditionIndex = 0;
foreach(var edition in ServerManager.SelectedServer.editions)
{
2024-05-21 20:15:19 +01:00
AvailableEditions.Add(new SPTEdition(edition));
}
2023-03-03 19:25:33 +00:00
}
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void RaisePropertyChanged(string property)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}
}
}