Inheritance: ElementSave
Exemplo n.º 1
0
        public ScreenSave AddScreen(string screenName)
        {
            ScreenSave screenSave = new ScreenSave();
            screenSave.Initialize( StandardElementsManager.Self.GetDefaultStateFor("Screen") );
            screenSave.Name = screenName;

            ProjectManager.Self.GumProjectSave.ScreenReferences.Add(new ElementReference { Name = screenName, ElementType = ElementType.Screen });
            ProjectManager.Self.GumProjectSave.ScreenReferences.Sort((first, second) => first.Name.CompareTo(second.Name));
            ProjectManager.Self.GumProjectSave.Screens.Add(screenSave);

            return screenSave;
        }
Exemplo n.º 2
0
        internal void RemoveScreen(ScreenSave asScreenSave)
        {
            GumProjectSave gps = ProjectManager.Self.GumProjectSave;

            string name = asScreenSave.Name;
            List<ElementReference> references = gps.ScreenReferences;

            RemoveElementReferencesFromList(name, references);

            gps.Screens.Remove(asScreenSave);
        }
Exemplo n.º 3
0
 public TreeNode GetTreeNodeFor(ScreenSave screenSave)
 {
     return GetTreeNodeForTag(screenSave, RootScreensTreeNode);
 }
Exemplo n.º 4
0
        public bool IsScreenNameValid(string screenName, ScreenSave screen, out string whyNotValid)
        {
            IsNameValidCommon(screenName, out whyNotValid);

            if (string.IsNullOrEmpty(whyNotValid))
            {
                IsNameAnExistingElement(screenName, screen, out whyNotValid);
            }

            return string.IsNullOrEmpty(whyNotValid);
        }
Exemplo n.º 5
0
        private void HandleNewScreen(FlatRedBall.Glue.SaveClasses.ScreenSave newScreen)
        {
            bool createGumScreen = propertiesManager.GetAutoCreateGumScreens();

            if(createGumScreen && AppState.Self.GumProjectSave != null)
            {
                string gumScreenName = FileManager.RemovePath( newScreen.Name ) + "Gum";

                bool exists = AppState.Self.GumProjectSave.Screens.Any(item => item.Name == gumScreenName);
                if (!exists)
                {
                    Gum.DataTypes.ScreenSave gumScreen = new Gum.DataTypes.ScreenSave();
                    gumScreen.Initialize(StandardElementsManager.Self.GetDefaultStateFor("Screen"));
                    gumScreen.Name = gumScreenName;

                    string gumProjectFileName = GumProjectManager.Self.GetGumProjectFileName();
                    var directory = FileManager.GetDirectory(gumProjectFileName) + ElementReference.ScreenSubfolder + "/";

                    AppState.Self.GumProjectSave.Screens.Add(gumScreen);
                    var elementReference = new ElementReference
                    {
                        ElementType = ElementType.Screen,
                        Name = gumScreenName
                    };
                    AppState.Self.GumProjectSave.ScreenReferences.Add(elementReference);
                    AppState.Self.GumProjectSave.ScreenReferences.Sort((first, second) => first.Name.CompareTo(second.Name));

                    AppState.Self.GumProjectSave.Save(gumProjectFileName, saveElements: false);

                    string screenFileName =
                        directory + gumScreen.Name + "." + GumProjectSave.ScreenExtension;


                    gumScreen.Save(screenFileName);

                }
                // Select the screen to add the file to this
                GlueState.Self.CurrentScreenSave = newScreen;

                RightClickManager.Self.AddScreenByName(gumScreenName);
            }
        }