private void CreateScreenTreeNodes() { for (int i = 0; i < ProjectManager.GlueProjectSave.Screens.Count; i++) { ScreenSave screenSave = ProjectManager.GlueProjectSave.Screens[i]; // This is so fast now that we don't even need to show the user // what's going on //SetInitWindowText("Creating Screens: " + screenSave.Name); ScreenTreeNode screenTreeNode = GlueState.Self.Find.ScreenTreeNode(ProjectManager.GlueProjectSave.Screens[i].Name); #region If there is no screenTreeNode if (screenTreeNode == null) { // See if the file exists string fileToSearchFor = FileManager.RelativeDirectory + screenSave.Name + ".cs"; if (System.IO.File.Exists(fileToSearchFor)) { // If we got here that means there's probably not a build item for this file MessageBox.Show("The Glue project has the following Screen:\n" + screenSave.Name + "\n" + "but this file is not part of Visual Studio. This file may have been removed manually or " + "there may have been some saving error. You should close Glue, manually add this and the Generated file " + "to Visual Studio, then restart Glue."); MainGlueWindow.Self.HasErrorOccurred = true; } else { System.Windows.Forms.MessageBox.Show("Could not create the ScreenSave for " + screenSave.Name); } //mGlueProjectSave.Screens.RemoveAt(i); //i--; continue; } #endregion screenTreeNode.SaveObject = ProjectManager.GlueProjectSave.Screens[i]; CheckForMissingCustomFile(screenTreeNode); if (ProjectManager.GlueProjectSave.Screens[i].IsRequiredAtStartup) { screenTreeNode.BackColor = ElementViewWindow.RequiredScreenColor; } screenTreeNode.UpdateReferencedTreeNodes(); screenTreeNode.SaveObject.UpdateCustomProperties(); } }
private void CreateScreenTreeNodes() { for (int i = 0; i < ProjectManager.GlueProjectSave.Screens.Count; i++) { ScreenSave screenSave = ProjectManager.GlueProjectSave.Screens[i]; ScreenTreeNode screenTreeNode = GlueState.Self.Find.ScreenTreeNode(ProjectManager.GlueProjectSave.Screens[i].Name); if (ProjectManager.GlueProjectSave.Screens[i].IsRequiredAtStartup) { screenTreeNode.BackColor = ElementViewWindow.RequiredScreenColor; } screenTreeNode.UpdateReferencedTreeNodes(); } }
public static void UpdateAllDerivedElementFromBaseValues(bool regenerateCode) { if (EditorLogic.CurrentEntitySave != null) { List <EntitySave> derivedEntities = ObjectFinder.Self.GetAllEntitiesThatInheritFrom(EditorLogic.CurrentEntitySave.Name); List <NamedObjectSave> nosList = ObjectFinder.Self.GetAllNamedObjectsThatUseEntity(EditorLogic.CurrentEntitySave.Name); for (int i = 0; i < derivedEntities.Count; i++) { EntitySave entitySave = derivedEntities[i]; nosList.AddRange(ObjectFinder.Self.GetAllNamedObjectsThatUseEntity(entitySave.Name)); entitySave.UpdateFromBaseType(); // Update the tree nodes EntityTreeNode treeNode = GlueState.Self.Find.EntityTreeNode(entitySave); treeNode.UpdateReferencedTreeNodes(); if (regenerateCode) { CodeWriter.GenerateCode(entitySave); } } foreach (NamedObjectSave nos in nosList) { nos.UpdateCustomProperties(); IElement element = nos.GetContainer(); if (element != null) { CodeWriter.GenerateCode(element); } } } else if (EditorLogic.CurrentScreenSave != null) { List <ScreenSave> derivedScreens = ObjectFinder.Self.GetAllScreensThatInheritFrom(EditorLogic.CurrentScreenSave.Name); for (int i = 0; i < derivedScreens.Count; i++) { ScreenSave screenSave = derivedScreens[i]; screenSave.UpdateFromBaseType(); ScreenTreeNode treeNode = GlueState.Self.Find.ScreenTreeNode(screenSave); treeNode.UpdateReferencedTreeNodes(); if (regenerateCode) { CodeWriter.GenerateCode(screenSave); } } } else { if (EditorLogic.CurrentNamedObject == null) { // This means the value is being set on the Screen itself throw new NotImplementedException(); } } }