Пример #1
0
 public PokemonDragDropData(PokemonViewModel data, DragDropActions allowedActions,
     IFolderViewModel source, int pmIndex)
 {
     this.Pokemon = data;
     this.AllowedActions = allowedActions;
     this.SourceFolder = source;
     this.PokemonIndexInFolder = pmIndex;
 }
Пример #2
0
        public PokemonViewModel(IFolderViewModel folderViewModel, PokemonCustomInfo model)
        {
            this.Folder = folderViewModel;
              this._model = model;
              InitializeCommand();

              PropertyChangedEventManager.AddListener(Model, this, "PokemonTypeId");
        }
Пример #3
0
 public void CloseFolder(IFolderViewModel folder)
 {
     if (folder.IsOpen)
       {
     folder.IsOpen = false;
     OpenWindows.Remove(folder);
       }
 }
Пример #4
0
 public void OpenFolder(IFolderViewModel folder)
 {
     if (!folder.IsOpen)
       {
     folder.IsOpen = true;
     OpenWindows.Add(folder);
       }
 }
Пример #5
0
 private static void CopyItemTo(IFolderViewModel folder, int destIndex, 
     PokemonDragDropData data)
 {
     folder.InsertPokemon(destIndex, data.Pokemon.Clone());
 }
Пример #6
0
        private static void SwapItem(IFolderViewModel folder, int swapIndex, 
            PokemonDragDropData data)
        {
            PokemonViewModel pokemon = data.Pokemon;
            int originalIndex = data.PokemonIndexInFolder;
            PokemonViewModel swapPokemon = folder.Pokemons[swapIndex];

            folder.RemovePokemon(swapPokemon);
            data.SourceFolder.RemovePokemon(pokemon);
            if (data.SourceFolder == folder && swapIndex < originalIndex)//swap within a folder
            {
                folder.InsertPokemon(swapIndex, pokemon);
                folder.InsertPokemon(originalIndex, swapPokemon);
                /*
                if (swapIndex < originalIndex)
                {
                }
                else
                {
                    folder.InsertPokemon(originalIndex, swapPokemon);
                    folder.InsertPokemon(swapIndex, pokemon);
                }
                 */
            }
            else//swap between folders
            {
                data.SourceFolder.InsertPokemon(originalIndex, swapPokemon);
                folder.InsertPokemon(swapIndex, pokemon);
            }
        }
Пример #7
0
 private static void SubstitueItem(IFolderViewModel folder, int destIndex, 
     PokemonDragDropData data)
 {
     folder.Pokemons[destIndex].RemoveSelf();
     folder.InsertPokemon(destIndex, data.Pokemon.Clone());
 }
Пример #8
0
        private static void MoveItemTo(IFolderViewModel folder, int destIndex, 
            PokemonDragDropData data)
        {
            //remove the origin item to prevent exceeding the size
            data.SourceFolder.RemovePokemon(data.Pokemon);

            //adjust index if it is movement within a folder
            if (folder == data.SourceFolder && destIndex > data.PokemonIndexInFolder)
                destIndex--;

            folder.InsertPokemon(destIndex, data.Pokemon);
        }