private void OnDeletePredefinedNumberRequested(IUserFilledSudokuBox sudokuBox) { if (sudokuBox == null) { return; } var foundViewModel = FindViewModel( sudokuBox.Coordinate, sudokuBox.ParentCoordinate ) as PredefinedSudokuBoxViewModel; if (foundViewModel?.Model == null || foundViewModel.Model.IsForControl) { return; } var viewModelIndex = mSudokuBoxViewModels.IndexOf(foundViewModel); var newUserDefinedViewModel = new UserFilledSudokuBoxViewModel( mModelsFactoryService.GetUserDefinedSudokuBox( sudokuBox.Coordinate, sudokuBox.ParentCoordinate, null), mSudokuService); mSudokuBoxViewModels.RemoveAt(viewModelIndex); mSudokuBoxViewModels.Insert(viewModelIndex, newUserDefinedViewModel); RefreshValues(); }
private void OnChangeNotesToUserDefinedRequest( INoteSudokuBox notesBox) { if (notesBox == null) { return; } var foundViewModel = FindViewModel( notesBox.Coordinate, notesBox.ParentCoordinate) as NoteSudokuBoxViewModel; if (foundViewModel == null) { return; } var viewModelIndex = mSudokuBoxViewModels.IndexOf(foundViewModel); var newPredefinedViewModel = new UserFilledSudokuBoxViewModel( mModelsFactoryService.GetUserDefinedSudokuBox( notesBox.Coordinate, notesBox.ParentCoordinate, null), mSudokuService); mSudokuBoxViewModels.RemoveAt(viewModelIndex); mSudokuBoxViewModels.Insert(viewModelIndex, newPredefinedViewModel); RefreshValues(); }