Exemple #1
0
        /// <summary>
        /// Saves the given file.
        /// </summary>
        protected override void Save(string fileName)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::ce.GEB_NGN_PCR_Practica1.Prototools modelRoot = (global::ce.GEB_NGN_PCR_Practica1.Prototools) this.RootElement;


            // Only save the diagrams if
            // a) There are any to save
            // b) This is NOT a SaveAs operation.  SaveAs should allow the subordinate document to control the save of its data as it is writing a new file.
            //    Except DO save the diagram on SaveAs if there isn't currently a diagram as there won't be a subordinate document yet to save it.

            bool saveAs = global::System.StringComparer.OrdinalIgnoreCase.Compare(fileName, this.FileName) != 0;

            global::System.Collections.Generic.IList <DslDiagrams::PresentationElement> diagrams = DslDiagrams::PresentationViewsSubject.GetPresentation(this.RootElement);
            if (diagrams.Count > 0 && (!saveAs || this.diagramDocumentLockHolder == null))
            {
                global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1Diagram diagram = diagrams[0] as global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1Diagram;
                if (diagram != null)
                {
                    string diagramFileName = fileName + this.DiagramExtension;
                    try
                    {
                        this.SuspendFileChangeNotification(diagramFileName);

                        global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1SerializationHelper.Instance.SaveModelAndDiagram(serializationResult, modelRoot, fileName, diagram, diagramFileName, this.Encoding, false);
                    }
                    finally
                    {
                        this.ResumeFileChangeNotification(diagramFileName);
                    }
                }
            }
            else
            {
                global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1SerializationHelper.Instance.SaveModel(serializationResult, modelRoot, fileName, this.Encoding, false);
            }
            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {                   // Save failed.
                throw new global::System.InvalidOperationException(global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1DomainModel.SingletonResourceManager.GetString("CannotSaveDocument"));
            }
        }
Exemple #2
0
 public static global::ce.GEB_NGN_PCR_Practica1.Prototools GetParentForVentana(global::ce.GEB_NGN_PCR_Practica1.Ventana root)
 {
     // Segments 0 and 1
     global::ce.GEB_NGN_PCR_Practica1.Prototools result = root.Prototools;
     if (result == null)
     {
         return(null);
     }
     return(result);
 }
 public static global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana GetLink(global::ce.GEB_NGN_PCR_Practica1.Prototools source, global::ce.GEB_NGN_PCR_Practica1.Ventana target)
 {
     global::System.Collections.Generic.IList <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana> links = DslModeling::DomainRoleInfo.GetElementLinks <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana>(source, global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana.PrototoolsDomainRoleId);
     foreach (global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana link in links)
     {
         if (target.Equals(link.Ventana))
         {
             return(link);
         }
     }
     return(null);
 }
Exemple #4
0
 public static global::ce.GEB_NGN_PCR_Practica1.Prototools GetParentForMenu(global::ce.GEB_NGN_PCR_Practica1.Menu root)
 {
     // Segments 0 and 1
     global::ce.GEB_NGN_PCR_Practica1.Ventana root2 = root.Ventana;
     if (root2 == null)
     {
         return(null);
     }
     // Segments 2 and 3
     global::ce.GEB_NGN_PCR_Practica1.Prototools result = root2.Prototools;
     if (result == null)
     {
         return(null);
     }
     return(result);
 }
Exemple #5
0
        /// <summary>
        /// Loads the given file.
        /// </summary>
        protected override void Load(string fileName, bool isReload)
        {
            DslModeling::SerializationResult serializationResult = new DslModeling::SerializationResult();

            global::ce.GEB_NGN_PCR_Practica1.Prototools modelRoot = null;
            DslModeling::ISchemaResolver schemaResolver           = new DslShell::ModelingSchemaResolver(this.ServiceProvider);

            //clear the current root element
            this.SetRootElement(null);
            // Enable diagram fixup rules in our store, because we will load diagram data.
            global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1DomainModel.EnableDiagramRules(this.Store);
            string diagramFileName = fileName + this.DiagramExtension;

            modelRoot = global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1SerializationHelper.Instance.LoadModelAndDiagram(serializationResult, this.GetModelPartition(), fileName, this.GetDiagramPartition(), diagramFileName, schemaResolver, null /* no load-time validation */, this.SerializerLocator);

            // Report serialization messages.
            this.SuspendErrorListRefresh();
            try
            {
                foreach (DslModeling::SerializationMessage serializationMessage in serializationResult)
                {
                    this.AddErrorListItem(new DslShell::SerializationErrorListItem(this.ServiceProvider, serializationMessage));
                }
            }
            finally
            {
                this.ResumeErrorListRefresh();
            }

            if (serializationResult.Failed)
            {
                // Load failed, can't open the file.
                throw new global::System.InvalidOperationException(global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1DomainModel.SingletonResourceManager.GetString("CannotOpenDocument"));
            }
            else
            {
                this.SetRootElement(modelRoot);

                // Attempt to set the encoding
                if (serializationResult.Encoding != null)
                {
                    this.ModelingDocStore.SetEncoding(serializationResult.Encoding);
                    global::Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(this.SetDocDataDirty(0));                     // Setting the encoding will mark the document as dirty, so clear the dirty flag.
                }

                if (this.Hierarchy != null && global::System.IO.File.Exists(diagramFileName))
                {
                    // Add a lock to the subordinate diagram file.
                    if (this.diagramDocumentLockHolder == null)
                    {
                        uint itemId = DslShell::SubordinateFileHelper.GetChildProjectItemId(this.Hierarchy, this.ItemId, this.DiagramExtension);
                        if (itemId != global::Microsoft.VisualStudio.VSConstants.VSITEMID_NIL)
                        {
                            this.diagramDocumentLockHolder = DslShell::SubordinateFileHelper.LockSubordinateDocument(this.ServiceProvider, this, diagramFileName, itemId);
                            if (this.diagramDocumentLockHolder == null)
                            {
                                throw new global::System.InvalidOperationException(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
                                                                                                 global::ce.GEB_NGN_PCR_Practica1.GEB_NGN_PCR_Practica1DomainModel.SingletonResourceManager.GetString("CannotCloseExistingDiagramDocument"),
                                                                                                 diagramFileName));
                            }
                        }
                    }
                }
            }
        }
 public static global::System.Collections.ObjectModel.ReadOnlyCollection <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana> GetLinks(global::ce.GEB_NGN_PCR_Practica1.Prototools source, global::ce.GEB_NGN_PCR_Practica1.Ventana target)
 {
     global::System.Collections.Generic.List <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana>  outLinks = new global::System.Collections.Generic.List <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana>();
     global::System.Collections.Generic.IList <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana> links    = DslModeling::DomainRoleInfo.GetElementLinks <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana>(source, global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana.PrototoolsDomainRoleId);
     foreach (global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana link in links)
     {
         if (target.Equals(link.Ventana))
         {
             outLinks.Add(link);
         }
     }
     return(outLinks.AsReadOnly());
 }
 public static global::System.Collections.ObjectModel.ReadOnlyCollection <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana> GetLinksToVentana(global::ce.GEB_NGN_PCR_Practica1.Prototools prototoolsInstance)
 {
     return(DslModeling::DomainRoleInfo.GetElementLinks <global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana>(prototoolsInstance, global::ce.GEB_NGN_PCR_Practica1.PrototoolsHasVentana.PrototoolsDomainRoleId));
 }