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.
96 lines
2.4 KiB
96 lines
2.4 KiB
using System;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel;
|
|
using System.Runtime.CompilerServices;
|
|
using Model;
|
|
namespace ViewModels
|
|
{
|
|
public class ChampionVm : INotifyPropertyChanged
|
|
{
|
|
public ChampionVm(Champion champion) => Model = champion;
|
|
|
|
private Champion model;
|
|
public ReadOnlyDictionary<string, int> Characteristics
|
|
{
|
|
get => Model.Characteristics;
|
|
}
|
|
public Champion Model
|
|
{
|
|
get => model;
|
|
set
|
|
{
|
|
if (value.Equals(model)) return;
|
|
if (value == null) return;
|
|
model = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public string Name
|
|
{
|
|
get => Model.Name;
|
|
}
|
|
|
|
public string Icon
|
|
{
|
|
get => Model.Icon;
|
|
set
|
|
{
|
|
if (model == null) return;
|
|
Model.Icon = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public string Image
|
|
{
|
|
get => Model.Image.Base64;
|
|
set
|
|
{
|
|
if (model == null) return;
|
|
Model.Image.Base64 = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
public ChampionClass Class
|
|
{
|
|
get => Model.Class;
|
|
set
|
|
{
|
|
if (model == null) return;
|
|
Model.Class = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
public string Bio
|
|
{
|
|
get => Model.Bio;
|
|
set
|
|
{
|
|
if (model == null) return;
|
|
Model.Bio = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
private ObservableCollection<Skill> skills;
|
|
public HashSet<Skill> Skills
|
|
{
|
|
get => Model.Skills.ToHashSet();
|
|
set
|
|
{
|
|
if (value.Equals(skills)) return;
|
|
skills = new ObservableCollection<Skill>(Skills);
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
}
|
|
}
|
|
|