Exemplo n.º 1
0
        public TransationEditorViewModel()
        {
            #region Commands
            TransitionAdd    = new RelayCommand(TransitionAddExecuted, TransitionCanAdd);
            TransitionRemove = new RelayCommand(TransitionRemoveExecuted, TransitionCanExecuteRemove);

            TileTransitionAdd           = new RelayCommand(TileAddExecuted, TileAddCanExecute);
            TextureTransitionTileRemove = new RelayCommand(TileRemoveExecuted, TileRemoveCanExecute);
            TileTransitionAddByString   = new RelayCommand(() =>
            {
                var value = SdkViewModel.ParseStringToInt(TextureIntString);
                SelectedLineTransition.Add(value);
            },
                                                           () => {
                if (string.IsNullOrWhiteSpace(TextureIntString))
                {
                    return(false);
                }
                var value = SdkViewModel.ParseStringToInt(TextureIntString);
                if (value < 0)
                {
                    return(false);
                }

                if (SelectedKindOfTransition == 1 && ApplicationController.manager.GetItemTile().Count() < value)
                {
                    return(false);
                }
                if (SelectedKindOfTransition == 0 && ApplicationController.manager.GetLandTile().Count() < value)
                {
                    return(false);
                }
                return(SelectedLineTransition != null && !SelectedLineTransition.Contains(value));
            });
            #endregion //Commands
        }
Exemplo n.º 2
0
 private Boolean TileAddCanExecute()
 {
     return(_selectedTile != null &&
            SelectedLineTransition != null &&
            !SelectedLineTransition.Contains((int)_selectedTile.EntryId));
 }