private void CreateFighter()
        {
            var options = OptionList.Where(o => o.Selected).Select(o => o.Name);

            _fighter          = _fighterFactory.CreateFighter(Lives, AttackValue, DefenseValue, options);
            _canCreateFighter = false;
            CreateFighterCommand.RaiseCanExecuteChanged();
        }
Exemple #2
0
        private void InitializeOptionList()
        {
            OptionList = new ObservableCollection <FighterOptionsViewModel>();

            foreach (var name in _fighterFactory.FighterOptions.Keys)
            {
                var description = _fighterFactory.FighterOptions[name];
                var optionsVM   = new FighterOptionsViewModel(name, description);
                optionsVM.PropertyChanged += (obj, prop) =>
                {
                    if (prop.PropertyName == "Selected")
                    {
                        _canCreateFighter = true;
                        CreateFighterCommand.RaiseCanExecuteChanged();
                    }
                };
                OptionList.Add(optionsVM);
            }
        }