public ResourceViewModel(object value, PlayerResourcesViewModel model) { Value = value; Reduce = new Command(() => { if (IsChangeable && last != null && last.Equals(ResourceID)) { Used++; model.MakeHistory("Resource" + ResourceID); if (Max > 0 && Used > Max) { Used = Max; } model.Context.Player.SetUsedResources(ResourceID, Used); model.UpdateUsed(); model.Save(); } last = ResourceID; }); }