internal void AddStateCategoryClick() { if (SelectedState.Self.SelectedElement == null) { MessageBox.Show("You must first select an element to add a state category"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new category name:"; if (tiw.ShowDialog() == DialogResult.OK) { string name = tiw.Result; StateSaveCategory category = ElementCommands.Self.AddCategory( SelectedState.Self.SelectedElement, name); RefreshUI(SelectedState.Self.SelectedElement); SelectedState.Self.SelectedStateCategorySave = category; GumCommands.Self.FileCommands.TryAutoSaveCurrentElement(); } } }
public void AskToAddComponent() { if (ObjectFinder.Self.GumProjectSave == null || string.IsNullOrEmpty(ProjectManager.Self.GumProjectSave.FullFileName)) { MessageBox.Show("You must first save the project before adding a new component"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new Component name:"; if (tiw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string name = tiw.Result; TreeNode nodeToAddTo = ElementTreeViewManager.Self.SelectedNode; while (nodeToAddTo != null && nodeToAddTo.Tag is ComponentSave && nodeToAddTo.Parent != null) { nodeToAddTo = nodeToAddTo.Parent; } if (nodeToAddTo == null || !nodeToAddTo.IsPartOfComponentsFolderStructure()) { nodeToAddTo = ElementTreeViewManager.Self.RootComponentsTreeNode; } FilePath path = nodeToAddTo.GetFullFilePath(); string relativeToComponents = FileManager.MakeRelative(path.StandardizedCaseSensitive, FileLocations.Self.ComponentsFolder, preserveCase: true); AddComponent(name, relativeToComponents); } } }
private void AskToStartTest() { var result = MessageBox.Show("Would you like to start this test?", "Start test", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { var textInputWindow = new TextInputWindow("Enter your name"); textInputWindow.ShowDialog(); if (textInputWindow.DialogResult == true) { var studentName = textInputWindow.EnteredText; var testPath = filePaths[PathsList.SelectedIndex]; var testDirectory = testPath.Substring(0, testPath.LastIndexOf('\\')); var passingWindow = new PassingWindow(testPath, $"{testDirectory}\\Results\\{studentName}.tmr", false, studentName); if (passingWindow.IsLoadedProperly) { passingWindow.Show(); Close(); } } } }
private void BtnRename_Click(object sender, System.Windows.RoutedEventArgs e) { if (FilePanel.SelectedIndex < 0) { return; } TextInputWindow ti = new TextInputWindow(); ti.Title = "Enter new file name:"; if (ti.ShowDialog() == true) { string oldkey = GetKey(FilePanel.SelectedIndex); if (File.Exists(_dir + "\\" + oldkey)) { try { File.Move(_dir + "\\" + oldkey, _dir + "\\" + ti.InputText); } catch (IOException ex) { WpfHelpers.ExceptionDialog("Error renaming file: " + oldkey, ex); return; } } _files.Add(ti.InputText, _files[oldkey]); _files.Remove(oldkey); } }
public void AddState() { if (SelectedState.Self.SelectedElement == null) { MessageBox.Show("You must first select an element to add a state"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new state name:"; if (tiw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string name = tiw.Result; StateSave stateSave = ElementCommands.Self.AddState( SelectedState.Self.SelectedElement, SelectedState.Self.SelectedStateCategorySave, name); StateTreeViewManager.Self.RefreshUI(SelectedState.Self.SelectedElement); SelectedState.Self.SelectedStateSave = stateSave; GumCommands.Self.FileCommands.TryAutoSaveCurrentElement(); } } }
private static NamedObjectSave HandleAddShape(string message, string sourceClassType) { NamedObjectSave toReturn = null; var tiw = new TextInputWindow(); tiw.Message = message; var dialogResult = tiw.ShowDialog(); if (dialogResult == DialogResult.OK) { string whyItIsntValid; NameVerifier.IsNamedObjectNameValid(tiw.Result, out whyItIsntValid); if (!string.IsNullOrEmpty(whyItIsntValid)) { GlueCommands.Self.DialogCommands.ShowMessageBox(whyItIsntValid); } else { var viewModel = new AddObjectViewModel(); viewModel.ObjectName = tiw.Result; viewModel.SourceType = SaveClasses.SourceType.FlatRedBallType; viewModel.SourceClassType = sourceClassType; toReturn = GlueCommands.Self.GluxCommands.AddNewNamedObjectToSelectedElement(viewModel); GlueState.Self.CurrentNamedObjectSave = toReturn; } } return(toReturn); }
private void AddNamedEventButton_Click(object sender, RoutedEventArgs e) { var textInputWindow = new TextInputWindow(); textInputWindow.Message = "Enter new event name"; var result = textInputWindow.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { AnimatedKeyframeViewModel newVm = new AnimatedKeyframeViewModel(); newVm.EventName = textInputWindow.Result; if (ViewModel.SelectedAnimation.SelectedKeyframe != null) { // put this after the current animation newVm.Time = ViewModel.SelectedAnimation.SelectedKeyframe.Time + 1f; } else if (ViewModel.SelectedAnimation.Keyframes.Count != 0) { newVm.Time = ViewModel.SelectedAnimation.Keyframes.Last().Time + 1f; } ViewModel.SelectedAnimation.Keyframes.Add(newVm); ViewModel.SelectedAnimation.Keyframes.BubbleSort(); } }
public bool Rename(RenameOptions renameOptions, out string newName) { if (renameOptions == null) { throw new ArgumentNullException(nameof(renameOptions)); } newName = null; var inputWindow = new TextInputWindow( renameOptions.WindowTitle ?? "Rename", renameOptions.WindowPrompt ?? "Rename:", renameOptions.WindowDefaultValue, renameOptions.IsInputMandatory ); if (inputWindow.ShowDialog() != true) { return(false); } if (inputWindow.Text == renameOptions.WindowDefaultValue) { return(false); } if (renameOptions.IsValid != null && renameOptions.IsValid(inputWindow.Text) == false) { MessageBox.Show($"Invalid name '{inputWindow.Text}'.", "Invalid name", MessageBoxButton.OK, MessageBoxImage.Error); return(false); } newName = inputWindow.Text; return(true); }
internal void Sprite() { if (ArrowState.Self.CurrentArrowElementSave != null) { TextInputWindow tiw = new TextInputWindow(); tiw.Text = "Enter new Sprite name:"; tiw.Result = "Sprite"; var result = tiw.ShowDialog(); if (result.HasValue && result.Value) { bool isInvalid = CheckAndShowMessageIfInvalid(tiw.Result); if (!isInvalid) { SpriteSave spriteSave = new SpriteSave(); spriteSave.ScaleX = 16; spriteSave.ScaleY = 16; spriteSave.Name = tiw.Result; spriteSave.ColorOperation = "Color"; spriteSave.TintRed = 255; spriteSave.TintGreen = 255; ArrowState.Self.CurrentArrowElementSave.Sprites.Add(spriteSave); AfterAddLogic(ArrowState.Self.CurrentArrowElementSave, spriteSave); } } } }
private void RefreshEventsForElement(ElementSave selectedElement) { EventsViewModel viewModel = new EventsViewModel(); viewModel.InstanceSave = null; viewModel.ElementSave = selectedElement; mEventsDataGrid.Instance = viewModel; mEventsDataGrid.MembersToIgnore.Add("InstanceSave"); mEventsDataGrid.MembersToIgnore.Add("ElementSave"); mEventsDataGrid.Categories[0].Name = "Events on this"; MemberCategory exposed = new MemberCategory(); exposed.Name = "Exposed"; var exposedEvents = SelectedState.Self.SelectedElement.Events.Where(item => !string.IsNullOrEmpty(item.ExposedAsName)); foreach (var eventSave in exposedEvents) { EventInstanceMember instanceMember = new EventInstanceMember( SelectedState.Self.SelectedElement, SelectedState.Self.SelectedInstance, eventSave); var local = eventSave; instanceMember.ContextMenuEvents.Add( "Rename", delegate { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new name"; tiw.Result = local.ExposedAsName; if (tiw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool isValid = true; // todo: //string whyNotValid = null; //isValid = NameVerifier.Self.IsEventNameValid(tiw.Result, out whyNotValid); if (isValid) { string oldName = local.ExposedAsName; local.ExposedAsName = tiw.Result; RenameManager.Self.HandleRename(selectedElement, local, oldName); GumCommands.Self.FileCommands.TryAutoSaveCurrentElement(); GumCommands.Self.GuiCommands.RefreshPropertyGrid(); } } }); exposed.Members.Add(instanceMember); } mEventsDataGrid.Categories.Add(exposed); }
internal void Rectangle() { if (ArrowState.Self.CurrentArrowElementSave != null) { TextInputWindow tiw = new TextInputWindow(); tiw.Text = "Enter new Rectangle name:"; tiw.Result = "Rectangle"; var result = tiw.ShowDialog(); if (result.HasValue && result.Value) { bool isInvalid = CheckAndShowMessageIfInvalid(tiw.Result); if (!isInvalid) { AxisAlignedRectangleSave rectangleSave = new AxisAlignedRectangleSave(); rectangleSave.ScaleX = 16; rectangleSave.ScaleY = 16; rectangleSave.Name = tiw.Result; ArrowState.Self.CurrentArrowElementSave.Rectangles.Add(rectangleSave); AfterAddLogic(ArrowState.Self.CurrentArrowElementSave, rectangleSave); } } } }
internal void Circle() { if (ArrowState.Self.CurrentArrowElementSave != null) { TextInputWindow tiw = new TextInputWindow(); tiw.Text = "Enter new Circle name:"; tiw.Result = "Circle"; var result = tiw.ShowDialog(); if (result.HasValue && result.Value) { bool isInvalid = CheckAndShowMessageIfInvalid(tiw.Result); if (!isInvalid) { CircleSave circleSave = new CircleSave(); circleSave.Radius = 16; circleSave.Name = tiw.Result; ArrowState.Self.CurrentArrowElementSave.Circles.Add(circleSave); AfterAddLogic(ArrowState.Self.CurrentArrowElementSave, circleSave); } } } }
public void AddCategory() { var target = SelectedState.Self.SelectedStateContainer as IStateCategoryListContainer; if (target == null) { MessageBox.Show("You must first select an element or behavior to add a state category"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new category name:"; if (tiw.ShowDialog() == DialogResult.OK) { string name = tiw.Result; StateSaveCategory category = ElementCommands.Self.AddCategory( target, name); ElementTreeViewManager.Self.RefreshUi(SelectedState.Self.SelectedStateContainer); StateTreeViewManager.Self.RefreshUI(SelectedState.Self.SelectedStateContainer); SelectedState.Self.SelectedStateCategorySave = category; GumCommands.Self.FileCommands.TryAutoSaveCurrentObject(); } } }
private void HandleRenameAnimation(object sender, RoutedEventArgs e) { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new animation name:"; tiw.Result = SelectedAnimation.Name; var dialogResult = tiw.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { string whyInvalid; if (!NameValidator.IsAnimationNameValid(tiw.Result, Animations, out whyInvalid)) { MessageBox.Show(whyInvalid); } else { var oldAnimationName = SelectedAnimation.Name; SelectedAnimation.Name = tiw.Result; StateAnimationPlugin.Managers.RenameManager.Self.HandleRename( SelectedAnimation, oldAnimationName, Animations, Element); } } }
public void AddCategory() { var target = SelectedState.Self.SelectedStateContainer as IStateCategoryListContainer; if (target == null) { MessageBox.Show("You must first select an element or behavior to add a state category"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new category name:"; var canAdd = true; var result = tiw.ShowDialog(); if (result != DialogResult.OK) { canAdd = false; } string name = null; if (canAdd) { name = tiw.Result; // see if any base elements have thsi category if (target is ElementSave element) { var existingCategory = element.GetStateSaveCategoryRecursively(name, out ElementSave categoryContainer); if (existingCategory != null) { MessageBox.Show($"Cannot add category - a category with the name {name} is already defined in {categoryContainer}"); canAdd = false; } } } if (canAdd) { StateSaveCategory category = ElementCommands.Self.AddCategory( target, name); ElementTreeViewManager.Self.RefreshUi(SelectedState.Self.SelectedStateContainer); StateTreeViewManager.Self.RefreshUI(SelectedState.Self.SelectedStateContainer); PluginManager.Self.CategoryAdd(category); SelectedState.Self.SelectedStateCategorySave = category; GumCommands.Self.FileCommands.TryAutoSaveCurrentObject(); } } }
void CreatePackFile() { TextInputWindow window = new TextInputWindow("New Packfile name", ""); if (window.ShowDialog() == true) { var newPackFile = _packfileService.CreateNewPackFileContainer(window.TextValue, PackFileCAType.MOD); _packfileService.SetEditablePack(newPackFile); } }
private void HandlePublishAsInput(object sender, RoutedEventArgs e) { if (m_OperatorParts.Count == 0) { return; } var cgv = App.Current.MainWindow.CompositionView.CompositionGraphView; List <ISelectable> selectedElements = cgv.SelectedElements; if (cgv.CompositionOperator.Parent == null) { MessageBox.Show("You cannot publish a parameter to the home-operator. First, either combine some operators into a new Operator-Type or open another operator.", "Sorry"); return; } var baseName = m_OperatorParts[0].Parent.GetMetaInput(m_OperatorParts[0]).Name.Split(new[] { '.' })[0]; var parameters = (from opPart in m_OperatorParts let splittedName = opPart.Parent.GetMetaInput(opPart).Name.Split(new[] { '.' }) select new { OpPart = opPart, SubName = splittedName.Count() > 1 ? splittedName.Last() : String.Empty }).ToList(); var popup = new TextInputWindow(); popup.XText.Text = "Input parameter name?"; popup.XTextBox.Text = baseName; popup.XTextBox.SelectAll(); popup.XTextBox.Focus(); popup.ShowDialog(); if (popup.DialogResult == false) { return; } var commandList = new List <ICommand>(); foreach (var p in parameters) { var name = popup.XTextBox.Text; if (p.SubName.Any()) { name += "." + p.SubName; } var publishCommand = new PublishAsInputCommand(p.OpPart, name); publishCommand.Do(); commandList.Add(publishCommand); } App.Current.UndoRedoStack.Add(new MacroCommand("Publish as Inputs", commandList)); if (m_OperatorParts.Count > 1) { cgv.SelectedElements = selectedElements; } }
public void AddComponentClick(object sender, EventArgs e) { if (ObjectFinder.Self.GumProjectSave == null || string.IsNullOrEmpty(ProjectManager.Self.GumProjectSave.FullFileName)) { MessageBox.Show("You must first save the project before adding a new component"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new Component name:"; if (tiw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string name = tiw.Result; string whyNotValid; if (!NameVerifier.Self.IsComponentNameValid(name, null, out whyNotValid)) { MessageBox.Show(whyNotValid); } else { TreeNode nodeToAddTo = ElementTreeViewManager.Self.SelectedNode; while (nodeToAddTo != null && nodeToAddTo.Tag is ComponentSave && nodeToAddTo.Parent != null) { nodeToAddTo = nodeToAddTo.Parent; } if (nodeToAddTo == null || !nodeToAddTo.IsPartOfComponentsFolderStructure()) { nodeToAddTo = RootComponentsTreeNode; } string path = nodeToAddTo.GetFullFilePath(); string relativeToComponents = FileManager.MakeRelative(path, FileLocations.Self.ComponentsFolder); ComponentSave componentSave = ProjectCommands.Self.AddComponent(relativeToComponents + name); GumCommands.Self.GuiCommands.RefreshElementTreeView(); SelectedState.Self.SelectedComponent = componentSave; GumCommands.Self.FileCommands.TryAutoSaveProject(); GumCommands.Self.FileCommands.TryAutoSaveElement(componentSave); } } } }
private static void AskToCreateEntity(out TextInputWindow tiw, out ControlForAddingCollision collisionControl, out DialogResult result) { tiw = new TextInputWindow(); tiw.DisplayText = "Enter entity name:"; collisionControl = new ControlForAddingCollision(); tiw.AddControl(collisionControl); result = tiw.ShowDialog(); }
private void BtnAdd_Click(object sender, System.Windows.RoutedEventArgs e) { TextInputWindow ti = new TextInputWindow(); ti.Title = "Enter new file name:"; if (ti.ShowDialog() == true) { _files.Add(ti.InputText + ".ino", ""); } FilePanel.ItemsSource = null; FilePanel.ItemsSource = _files; FilePanel.SelectedIndex = FilePanel.Items.Count - 1; SwitchDocuments(); }
public ArrowElementSave Element() { TextInputWindow tiw = new TextInputWindow(); tiw.Text = "Enter new element name:"; List <string> intentNames = new List <string>(); const string noIntent = "<NO INTENT>"; intentNames.Add(noIntent); foreach (var item in ArrowState.Self.CurrentArrowProject.Intents) { intentNames.Add(item.Name); } var treeView = tiw.AddTreeView(intentNames); var result = tiw.ShowDialog(); if (result.HasValue && result.Value) { ArrowElementSave toReturn = new ArrowElementSave(); toReturn.Name = tiw.Result; ArrowProjectSave projectToAddTo = ArrowState.Self.CurrentArrowProject; if (treeView.SelectedItem as string != noIntent) { toReturn.Intent = treeView.SelectedItem as string; ArrowIntentSave intent = new ArrowIntentSave(); IntentManager.Self.AddRequirementsForIntent(toReturn, intent); } projectToAddTo.Elements.Add(toReturn); ArrowCommands.Self.File.SaveProject(); ArrowCommands.Self.File.GenerateGlux(); ArrowState.Self.CurrentArrowProjectVm.Refresh(); return(toReturn); } else { return(null); } }
private void AddItemClick(object sender, RoutedEventArgs e) { TextInputWindow tiw = new TextInputWindow(); tiw.Text = "Enter new Intent name"; var result = tiw.ShowDialog(); if (result.HasValue && result.Value) { ViewModel.AddNewIntent(tiw.Result); SaveEverything(); } }
private void AddNewTest() { var textInputWindow = new TextInputWindow("Enter the name of the test"); textInputWindow.ShowDialog(); if (textInputWindow.DialogResult == true) { var testName = textInputWindow.EnteredText; var pathToTest = $"Tests\\{testName}\\{testName}.tmt"; var redactingWindow = new RedactingWindow(pathToTest, true); redactingWindow.Show(); Close(); } }
private static void RenameStateClick() { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new name"; tiw.Result = SelectedState.Self.SelectedStateSave.Name; var result = tiw.ShowDialog(); if (result == DialogResult.OK) { SelectedState.Self.SelectedStateSave.Name = tiw.Result; GumCommands.Self.GuiCommands.RefreshStateTreeView(); // I don't think we need to save the project when renaming a state: //GumCommands.Self.FileCommands.TryAutoSaveProject(); GumCommands.Self.FileCommands.TryAutoSaveCurrentElement(); } }
public void AddBehavior() { if (ObjectFinder.Self.GumProjectSave == null || string.IsNullOrEmpty(ProjectManager.Self.GumProjectSave.FullFileName)) { MessageBox.Show("You must first save the project before adding a new component"); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new behavior name:"; if (tiw.ShowDialog() == DialogResult.OK) { string name = tiw.Result; string whyNotValid; NameVerifier.Self.IsBehaviorNameValid(name, null, out whyNotValid); if (!string.IsNullOrEmpty(whyNotValid)) { MessageBox.Show(whyNotValid); } else { var behavior = new BehaviorSave(); behavior.Name = name; ProjectManager.Self.GumProjectSave.BehaviorReferences.Add(new BehaviorReference { Name = name }); ProjectManager.Self.GumProjectSave.BehaviorReferences.Sort((first, second) => first.Name.CompareTo(second.Name)); ProjectManager.Self.GumProjectSave.Behaviors.Add(behavior); GumCommands.Self.GuiCommands.RefreshElementTreeView(); SelectedState.Self.SelectedBehavior = behavior; GumCommands.Self.FileCommands.TryAutoSaveProject(); GumCommands.Self.FileCommands.TryAutoSaveBehavior(behavior); } } } }
internal void ElementInstance() { if (ArrowState.Self.CurrentArrowElementSave != null) { //Show a text input window for the name, but add a combo box so the user can select the type TextInputWindow tiw = new TextInputWindow(); TreeView treeView = new TreeView(); treeView.HorizontalAlignment = HorizontalAlignment.Stretch; treeView.VerticalAlignment = VerticalAlignment.Top; treeView.Height = 80; treeView.Margin = new Thickness(3); List <ArrowElementSave> toAddToTreeView = new List <ArrowElementSave>(); foreach (var elementSave in ArrowState.Self.CurrentArrowProject.Elements) { if (elementSave != null && elementSave != ArrowState.Self.CurrentArrowElementSave) { toAddToTreeView.Add(elementSave); } } treeView.ItemsSource = toAddToTreeView; tiw.AddControl(treeView); bool?result = tiw.ShowDialog(); if (result.HasValue && result.Value) { ArrowElementSave typeToAdd = treeView.SelectedItem as ArrowElementSave; string name = tiw.Result; ElementInstance(name, typeToAdd); } //tiw.AddControl } }
private void AddAnimationButton_Click(object sender, RoutedEventArgs e) { if (ViewModel == null) { throw new NullReferenceException("The ViewModel for this is invalid - set the DataContext on this view before showing it."); } string whyIsntValid = null; if (!string.IsNullOrEmpty(whyIsntValid)) { MessageBox.Show(whyIsntValid); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new animation name:"; var dialogResult = tiw.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { string whyInvalid; if (!NameValidator.IsAnimationNameValid(tiw.Result, this.ViewModel.Animations, out whyInvalid)) { MessageBox.Show(whyInvalid); } else { var newAnimation = new AnimationViewModel() { Name = tiw.Result }; this.ViewModel.Animations.Add(newAnimation); this.ViewModel.SelectedAnimation = newAnimation; } } } }
private void HandleSquashStretchTimes(object sender, RoutedEventArgs e) { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Set desired animation length (in seconds):"; tiw.Result = SelectedAnimation.Length.ToString(CultureInfo.InvariantCulture); var dialogResult = tiw.ShowDialog(); if (dialogResult == System.Windows.Forms.DialogResult.OK) { float value = 0; var didParse = float.TryParse(tiw.Result, out value); string errorMessage = null; if (!didParse) { errorMessage = "Please enter a valid number"; } if (errorMessage == null && value < 0) { errorMessage = "Value must be greater than 0"; } if (errorMessage != null) { MessageBox.Show(errorMessage); } else if (SelectedAnimation.Length != 0) { var multiplier = value / SelectedAnimation.Length; foreach (var frame in this.SelectedAnimation.Keyframes.ToArray()) { frame.Time *= multiplier; } } } }
public void AddInstanceClick(object sender, EventArgs e) { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new object name:"; if (tiw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string name = tiw.Result; string whyNotValid; if (!NameVerifier.Self.IsInstanceNameValid(name, null, SelectedState.Self.SelectedElement, out whyNotValid)) { MessageBox.Show(whyNotValid); } else { AddInstance(name, StandardElementsManager.Self.DefaultType, SelectedState.Self.SelectedElement); } } }
internal void RenameStateCategory(StateSaveCategory category, ElementSave elementSave) { // This category can only be renamed if no behaviors require it var behaviorsNeedingCategory = DeleteLogic.Self.GetBehaviorsNeedingCategory(category, elementSave as ComponentSave); if (behaviorsNeedingCategory.Any()) { string message = "This category cannot be renamed because it is needed by the following behavior(s):"; foreach (var behavior in behaviorsNeedingCategory) { message += "\n" + behavior.Name; } MessageBox.Show(message); } else { TextInputWindow tiw = new TextInputWindow(); tiw.Message = "Enter new category name"; tiw.Result = category.Name; var result = tiw.ShowDialog(); if (result == DialogResult.OK) { string oldName = category.Name; category.Name = tiw.Result; GumCommands.Self.GuiCommands.RefreshStateTreeView(); // I don't think we need to save the project when renaming a state: //GumCommands.Self.FileCommands.TryAutoSaveProject(); PluginManager.Self.CategoryRename(category, oldName); GumCommands.Self.FileCommands.TryAutoSaveCurrentObject(); } } }