private void RenameCurrentModelSystem() { var modelSystem = Display.SelectedItem as ModelSystem; if (modelSystem != null) { var selectedModuleControl = GetCurrentlySelectedControl(); var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); Renaming = true; var adorn = new TextboxAdorner("Rename", (result) => { string error = null; if (!Runtime.ModelSystemController.Rename(modelSystem, result, ref error)) { MessageBox.Show(GetWindow(), error, "Unable to Rename Model System", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } else { RefreshModelSystems(); } }, selectedModuleControl, modelSystem.Name); adorn.Unloaded += Adorn_Unloaded; layer.Add(adorn); adorn.Focus(); } }
private void RenameCurrentProject() { if (Display.SelectedItem is Project project) { var name = project.Name; var selectedModuleControl = GetCurrentlySelectedControl(); var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); Renaming = true; var adorn = new TextboxAdorner("Rename", result => { string error = null; if (!Runtime.ProjectController.RenameProject(project, result, ref error)) { MessageBox.Show(GetWindow(), error, "Unable to Rename Project", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } else { Runtime.Configuration.RenameRecentProject(name, result); Runtime.Configuration.Save(); RefreshProjects(); } }, selectedModuleControl, project.Name); adorn.Unloaded += Adorn_Unloaded; layer.Add(adorn); adorn.Focus(); } }
private void Rename() { var selected = Display.SelectedItem as LinkedParameterDisplayModel; if (selected != null) { var selectedModuleControl = GetCurrentlySelectedControl(); var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); Renaming = true; var adorn = new TextboxAdorner("Rename", (result) => { selected.Name = result; }, selectedModuleControl, selected.Name); adorn.Unloaded += Adorn_Unloaded; layer.Add(adorn); adorn.Focus(); } }
private void RenameModelSystem() { var selected = ModelSystemDisplay.SelectedItem as ProjectModel.ContainedModelSystemModel; if (selected != null) { var container = ModelSystemDisplay.ItemContainerGenerator.ContainerFromItem(selected) as ListBoxItem; var layer = AdornerLayer.GetAdornerLayer(container); var adorn = new TextboxAdorner("Rename", (result) => { string error = null; if (!selected.SetName(Session, result, ref error)) { MessageBox.Show(error, "Unable to Rename Model System", MessageBoxButton.OK, MessageBoxImage.Error); } }, container, selected.Name); layer.Add(adorn); adorn.Focus(); } }
private void ChangeCurrentDescription() { if (Display.SelectedItem is Project project) { var selectedModuleControl = GetCurrentlySelectedControl(); var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); Renaming = true; var adorn = new TextboxAdorner("Change Description", result => { string error = null; if (!Runtime.ProjectController.SetDescription(project, result, ref error)) { MessageBox.Show(GetWindow(), error, "Unable to Rename Project", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK); } else { RefreshProjects(); } }, selectedModuleControl, project.Description); adorn.Unloaded += Adorn_Unloaded; layer.Add(adorn); adorn.Focus(); } }
private void Rename() { var selected = Display.SelectedItem as LinkedParameterDisplayModel; if(selected != null) { var selectedModuleControl = GetCurrentlySelectedControl(); var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); Renaming = true; var adorn = new TextboxAdorner("Rename", (result) => { selected.Name = result; }, selectedModuleControl, selected.Name); adorn.Unloaded += Adorn_Unloaded; layer.Add(adorn); adorn.Focus(); } }
private void Rename() { var selected = (ModuleDisplay.SelectedItem as ModelSystemStructureDisplayModel).BaseModel; var selectedModuleControl = GetCurrentlySelectedControl(); if(selectedModuleControl != null) { var layer = AdornerLayer.GetAdornerLayer(selectedModuleControl); var adorn = new TextboxAdorner("Rename", (result) => { string error = null; if(!selected.SetName(result, ref error)) { throw new Exception(error); } }, selectedModuleControl, selected.Name); layer.Add(adorn); adorn.Focus(); } else { throw new InvalidAsynchronousStateException("The current module could not be found!"); } }