Пример #1
0
        private void CreateActionGroups(CharacterEditorViewModel viewModel)
        {
            viewModel.CharacterActionGroups = new System.Collections.ObjectModel.ObservableCollection <HeroVirtualTabletop.ManagedCharacter.CharacterActionGroupViewModel>();
            var identityGroup = new CharacterActionGroupViewModelImpl <Identity>(TestObjectsFactory.MockDesktopKeyEventHandler, viewModel.EventAggregator);
            var abilityGroup  = new CharacterActionGroupViewModelImpl <AnimatedAbility.AnimatedAbility>(TestObjectsFactory.MockDesktopKeyEventHandler, viewModel.EventAggregator);
            var movementGroup = new CharacterActionGroupViewModelImpl <CharacterMovement>(TestObjectsFactory.MockDesktopKeyEventHandler, viewModel.EventAggregator);
            var customGroup   = new CharacterActionGroupViewModelImpl <CharacterAction>(TestObjectsFactory.MockDesktopKeyEventHandler, viewModel.EventAggregator);

            viewModel.CharacterActionGroups.Add(identityGroup);
            viewModel.CharacterActionGroups.Add(abilityGroup);
            viewModel.CharacterActionGroups.Add(movementGroup);
            viewModel.CharacterActionGroups.Add(customGroup);
        }
        public void AddActionGroup()
        {
            string newActionGroupName     = this.EditedCharacter.GetnewValidActionGroupName();
            CharacterActionGroup actGroup = new CharacterActionListImpl <CharacterAction>(CharacterActionType.Mixed, this.EditedCharacter.Generator, this.EditedCharacter);

            actGroup.Name = newActionGroupName;
            this.EditedCharacter.AddActionGroup(actGroup);
            CharacterActionGroupViewModelImpl <CharacterAction> mixedActionGroup = null;

            try
            {
                mixedActionGroup = IoC.Get <CharacterActionGroupViewModelImpl <CharacterAction> >();
            }
            catch
            {
                mixedActionGroup = new CharacterActionGroupViewModelImpl <CharacterAction>(this.DesktopKeyEventHandler, this.EventAggregator);
            }
            mixedActionGroup.ActionGroup         = actGroup;
            mixedActionGroup.NewActionGroupAdded = true;
            this.CharacterActionGroups.Add(mixedActionGroup);
            this.EventAggregator.Publish(new CrowdCollectionModifiedEvent(), action => System.Windows.Application.Current.Dispatcher.Invoke(action));
        }