예제 #1
0
 /// <summary>
 /// Add a model system to the project
 /// </summary>
 /// <param name="modelSystem">The model system to add to the project</param>
 /// <param name="error">An error message in case of failure</param>
 /// <returns>True if the model system was added successfully</returns>
 public bool AddModelSystem(ModelSystem modelSystem, ref string error)
 {
     if (modelSystem == null)
     {
         throw new ArgumentNullException(nameof(modelSystem));
     }
     lock (_EditingSessionsLock)
     {
         if (!Project.AddModelSystem(modelSystem, modelSystem.Name, ref error))
         {
             return(false);
         }
         var temp = new SessionData[_EditingSessions.Length + 1];
         Array.Copy(_EditingSessions, temp, _EditingSessions.Length);
         _EditingSessions = temp;
         return(true);
     }
 }
예제 #2
0
 public bool CloneModelSystemToProjectAs(IModelSystemStructure root, string name, ref string error)
 {
     lock (EditingSessionsLock)
     {
         var index = Project.ModelSystemStructure.IndexOf(root);
         if (index < 0)
         {
             error = "The model system was not found within the project!";
             return(false);
         }
         if (Project.AddModelSystem(index, name, ref error))
         {
             var temp = new SessionData[EditingSessions.Length + 1];
             Array.Copy(EditingSessions, temp, EditingSessions.Length);
             EditingSessions = temp;
             return(true);
         }
         return(false);
     }
 }