private void EditRequested(WorldVariableViewModel viewModel) { using (var worldVariableController = _controllerFactory.Create <IWorldVariableController>()) { WorldVariableViewModel currentViewModel = View.SelectedVariables.Single(); WorldVariableViewModel editedViewModel = currentViewModel.Clone(); while (true) { editedViewModel = worldVariableController.ShowEditView(View, editedViewModel); if (editedViewModel == null) { return; } if (!currentViewModel.Name.Equals(editedViewModel.Name) && !IsVariableNameUnique(editedViewModel.Name)) { continue; } View.ReplaceVariable(currentViewModel, editedViewModel); return; } } }
public void AddVariable(WorldVariableViewModel viewModel) { viewModel.ThrowIfNull(nameof(viewModel)); _worldVariableViewModels.Add(viewModel); RefreshFilter(true); }
public void ReplaceVariable(WorldVariableViewModel currentViewModel, WorldVariableViewModel editedViewModel) { currentViewModel.ThrowIfNull(nameof(currentViewModel)); editedViewModel.ThrowIfNull(nameof(editedViewModel)); _worldVariableViewModels.Remove(currentViewModel); _worldVariableViewModels.Add(editedViewModel); RefreshFilter(true); }
private void NewRequested() { using (var worldVariableController = _controllerFactory.Create <IWorldVariableController>()) { WorldVariableViewModel viewModel = null; while (true) { viewModel = worldVariableController.ShowNewView(View, viewModel, View.CategoryFilter); if (viewModel == null) { return; } if (!IsVariableNameUnique(viewModel.Name)) { continue; } View.AddVariable(viewModel); return; } } }