private void DelEntity() { if (SelectedMoveViewModel == null) { return; } var index = MoveListViewModels.IndexOf(SelectedMoveViewModel); /* * non cancello punto iniziale ! */ if (SelectedMoveViewModel is RawInitPointViewModel) { return; } MoveListViewModels.Remove(SelectedMoveViewModel); OnPropertyChanged("MoveListViewModels"); index--; var nextFocused = MoveListViewModels.ElementAtOrDefault(index); SelectedMoveViewModel = nextFocused; }
private void InsertMove(RawEntity2D rawEntity2D) { /* * in pratica ora , creo il viewModel poi inserisco. * * sarebbe piĆ¹ chiaro avere il model , inserirlo li poi riaggirnare parteViewModel */ RawItemViewModel precMove = null; var entityToInsert = GetViewModel(rawEntity2D); if (SelectedMoveViewModel == null) { precMove = MoveListViewModels.LastOrDefault(); MoveListViewModels.Add(entityToInsert); } else { precMove = MoveListViewModels.ElementAtOrDefault(MoveListViewModels.IndexOf(SelectedMoveViewModel)); MoveListViewModels.Insert(MoveListViewModels.IndexOf(SelectedMoveViewModel) + 1, entityToInsert); } InitEntity(rawEntity2D, precMove.RawEntity); SelectedMoveViewModel = entityToInsert; RequestUpdateSource(); }
private void GotoPrevMove() { if (SelectedMoveViewModel == MoveListViewModels.First()) { return; } var index = MoveListViewModels.IndexOf(SelectedMoveViewModel); index--; if (index < 0) { return; } SelectedMoveViewModel = MoveListViewModels[index]; }
private void GotoNextMove() { if (SelectedMoveViewModel == MoveListViewModels.Last()) { return; } var index = MoveListViewModels.IndexOf(SelectedMoveViewModel); index++; if (index > MoveListViewModels.Count) { return; } SelectedMoveViewModel = MoveListViewModels[index]; }