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-09-02 07:53:58 +00:00
|
|
|
using SPT.Launcher.Utilities;
|
2023-03-03 19:25:33 +00:00
|
|
|
|
2024-05-21 20:15:19 +01:00
|
|
|
namespace SPT.Launcher.Models.Launcher
|
2023-03-03 19:25:33 +00:00
|
|
|
{
|
2024-09-02 07:53:58 +00:00
|
|
|
public class EditionCollection : NotifyPropertyChangedBase
|
2023-03-03 19:25:33 +00:00
|
|
|
{
|
2024-09-02 07:53:58 +00:00
|
|
|
private bool _hasSelection;
|
2023-03-03 19:25:33 +00:00
|
|
|
public bool HasSelection
|
|
|
|
{
|
2024-09-02 07:53:58 +00:00
|
|
|
get => _hasSelection;
|
|
|
|
set => SetProperty(ref _hasSelection, value);
|
2023-03-03 19:25:33 +00:00
|
|
|
}
|
2024-09-02 07:53:58 +00:00
|
|
|
private int _selectedEditionIndex;
|
2023-03-03 19:25:33 +00:00
|
|
|
public int SelectedEditionIndex
|
|
|
|
{
|
2024-09-02 07:53:58 +00:00
|
|
|
get => _selectedEditionIndex;
|
|
|
|
set => SetProperty(ref _selectedEditionIndex, value);
|
2023-03-03 19:25:33 +00:00
|
|
|
}
|
|
|
|
|
2024-09-02 07:53:58 +00:00
|
|
|
private SPTEdition _selectedEdition;
|
2024-05-21 20:15:19 +01:00
|
|
|
public SPTEdition SelectedEdition
|
2023-03-03 19:25:33 +00:00
|
|
|
{
|
2024-09-02 07:53:58 +00:00
|
|
|
get => _selectedEdition;
|
|
|
|
set => SetProperty(ref _selectedEdition, value, () => HasSelection = _selectedEdition != null);
|
2023-03-03 19:25:33 +00:00
|
|
|
}
|
2024-09-02 07:53:58 +00:00
|
|
|
public ObservableCollection<SPTEdition> AvailableEditions { get; private set; } = [];
|
2023-03-03 19:25:33 +00:00
|
|
|
|
|
|
|
public EditionCollection()
|
|
|
|
{
|
|
|
|
SelectedEditionIndex = 0;
|
2023-03-15 19:34:29 -04:00
|
|
|
|
|
|
|
foreach(var edition in ServerManager.SelectedServer.editions)
|
|
|
|
{
|
2024-05-21 20:15:19 +01:00
|
|
|
AvailableEditions.Add(new SPTEdition(edition));
|
2023-03-15 19:34:29 -04:00
|
|
|
}
|
2023-03-03 19:25:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|