Пример #1
0
        internal void HandleElementDelete(ElementSave gumElement)
        {
            var glueProject = GluePluginState.Self.GlueProject;

            ///////////////////////Early Out///////////////////////
            if (glueProject == null || GluePluginState.Self.InitializationState != InitializationState.Initialized)
            {
                return;
            }
            ////////////////////End Early Out/////////////////////


            var glueElement = GluePluginObjectFinder.Self.GetGlueElementFrom(gumElement);

            if (glueElement is GlueScreen)
            {
                glueProject.Screens.Remove(glueElement as GlueScreen);
            }
            else if (glueElement is GlueEntity)
            {
                glueProject.Entities.Remove(glueElement as GlueEntity);
            }

            var project = VisualStudioProjectSave.Load(
                GluePluginState.Self.CsprojFilePath.StandardizedCaseSensitive);

            RemoveCodeFilesFromProject(glueElement, project.XDocument.Elements());
            project.XDocument.Save(GluePluginState.Self.CsprojFilePath.StandardizedCaseSensitive);

            FileManager.XmlSerialize(glueProject, GluePluginState.Self.GlueProjectFilePath.StandardizedCaseSensitive);
        }
Пример #2
0
        private void LoadGlueProject(string fileName)
        {
            GluePluginState.Self.InitializationState = InitializationState.Initializing;

            var glueProjectSave = ToolsUtilities.FileManager.XmlDeserialize <GlueProjectSave>(fileName);

            GluePluginState.Self.GlueProject         = glueProjectSave;
            GluePluginState.Self.GlueProjectFilePath = fileName;

            GluePluginState.Self.CsprojFilePath = GluePluginState.Self.GlueProjectFilePath.RemoveExtension() + ".csproj";

            var vsProject = VisualStudioProjectSave.Load(GluePluginState.Self.CsprojFilePath);

            GluePluginState.Self.ProjectRootNamespace = vsProject.GetRootNamespace();


            var gumProject = GlueToGumProjectConverter.Self.ToGumProjectSave(glueProjectSave);

            FilePath glueFilePath = fileName;
            var      directory    = glueFilePath.GetDirectoryContainingThis();
            var      saveLocation = directory + "GumGluePlugin/testGum.gumx";

            // to prevent a reload:
            FileWatchLogic.Self.IgnoreNextChangeOn(saveLocation);
            gumProject.Save(saveLocation, saveElements: true);

            GumCommands.Self.FileCommands.LoadProject(saveLocation);


            StandardElementsCustomizationLogic.Self.CustomizeStandardElements();

            GluePluginState.Self.InitializationState = InitializationState.Initialized;
        }