You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
98 lines
2.2 KiB
98 lines
2.2 KiB
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Linq;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace LolVM
|
|
{
|
|
public class ChampionVM : INotifyPropertyChanged
|
|
{
|
|
public Champion Model
|
|
{
|
|
get => _model;
|
|
set
|
|
{
|
|
if (_model != null)
|
|
{
|
|
_model = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
}
|
|
private Champion _model;
|
|
|
|
public string Name
|
|
{
|
|
get => _model.Name;
|
|
}
|
|
|
|
public string Bio
|
|
{
|
|
get => Model.Bio;
|
|
set
|
|
{
|
|
if (_model.Bio.Equals(value)) return;
|
|
_model.Bio = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public string Image
|
|
{
|
|
get => Model.Image.Base64;
|
|
set
|
|
{
|
|
if (_model.Icon.Equals(value)) return;
|
|
_model.Image.Base64 = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public string Icon
|
|
{
|
|
get => Model.Icon;
|
|
set
|
|
{
|
|
if (_model.Icon.Equals(value)) return;
|
|
_model.Icon = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public IReadOnlyDictionary<String, int> Characteristics
|
|
{
|
|
get => Model.Characteristics;
|
|
}
|
|
|
|
public HashSet<SkillVM> Skills
|
|
{
|
|
get
|
|
{
|
|
HashSet<SkillVM> skillVMs = new HashSet<SkillVM>();
|
|
foreach(Skill s in Model.Skills)
|
|
{
|
|
skillVMs.Add(new SkillVM(s));
|
|
}
|
|
return skillVMs;
|
|
}
|
|
}
|
|
|
|
public string Class { get => Model.Class.ToString(); }
|
|
|
|
public ChampionVM(Champion model)
|
|
{
|
|
_model = model;
|
|
}
|
|
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
public void OnPropertyChanged([CallerMemberName] string name = "") =>
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
|
}
|
|
}
|