Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        public void AddVariable(WorldVariableViewModel viewModel)
        {
            viewModel.ThrowIfNull(nameof(viewModel));

            _worldVariableViewModels.Add(viewModel);

            RefreshFilter(true);
        }
Ejemplo n.º 3
0
        public void ReplaceVariable(WorldVariableViewModel currentViewModel, WorldVariableViewModel editedViewModel)
        {
            currentViewModel.ThrowIfNull(nameof(currentViewModel));
            editedViewModel.ThrowIfNull(nameof(editedViewModel));

            _worldVariableViewModels.Remove(currentViewModel);
            _worldVariableViewModels.Add(editedViewModel);

            RefreshFilter(true);
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }