Ejemplo n.º 1
0
 public ProjectEditingSession(Project project, XTMFRuntime runtime)
 {
     Project                  = project;
     _Runtime                 = runtime;
     _EditingSessions         = new SessionData[Project.ModelSystemStructure.Count];
     project.ExternallySaved += Project_ExternallySaved;
 }
 /// <summary>
 ///     Create a model editing session for a previous run.  This will be read-only!
 /// </summary>
 /// <param name="runtime">A link to the XTMFRuntime</param>
 /// <param name="projectSession">The project this is for.</param>
 /// <param name="runFile">The location of the previous run.</param>
 public ModelSystemEditingSession(XTMFRuntime runtime, ProjectEditingSession projectSession, string runFile)
 {
     _Runtime = runtime;
     ProjectEditingSession = projectSession;
     _ModelSystemIndex     = -1;
     ModelSystemModel      = new ModelSystemModel(_Runtime, this, projectSession.Project, runFile);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a new session to edit a model system
 /// </summary>
 /// <param name="modelSystem">The model system to edit</param>
 public ModelSystemEditingSession(XTMFRuntime runtime, ModelSystem modelSystem)
 {
     Runtime          = runtime;
     ModelSystem      = modelSystem;
     ModelSystemModel = new ModelSystemModel(this, modelSystem);
     ModelSystemModel.PropertyChanged += ModelSystemModel_PropertyChanged;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new editing session to edit a project's model system
 /// </summary>
 /// <param name="ProjectEditingSession">The editing session to read from</param>
 /// <param name="modelSystemIndex">The model system's index inside of the project</param>
 public ModelSystemEditingSession(XTMFRuntime runtime, ProjectEditingSession ProjectEditingSession, int modelSystemIndex)
 {
     Runtime = runtime;
     this.ProjectEditingSession = ProjectEditingSession;
     ModelSystemIndex           = modelSystemIndex;
     Reload();
 }
 /// <summary>
 ///     Create a new session to edit a model system
 /// </summary>
 /// <param name="modelSystem">The model system to edit</param>
 public ModelSystemEditingSession(XTMFRuntime runtime, ModelSystem modelSystem)
 {
     _Runtime         = runtime;
     _ModelSystem     = modelSystem;
     ModelSystemModel = new ModelSystemModel(this, modelSystem);
     ModelSystemModel.PropertyChanged += ModelSystemModel_PropertyChanged;
     _saveSemaphor = new Semaphore(1, 1);
 }
 /// <summary>
 ///     Create a new editing session to edit a project's model system
 /// </summary>
 /// <param name="ProjectEditingSession">The editing session to read from</param>
 /// <param name="modelSystemIndex">The model system's index inside of the project</param>
 public ModelSystemEditingSession(XTMFRuntime runtime, ProjectEditingSession ProjectEditingSession,
                                  int modelSystemIndex)
 {
     _Runtime = runtime;
     this.ProjectEditingSession = ProjectEditingSession;
     _ModelSystemIndex          = modelSystemIndex;
     Reload();
     _saveSemaphor = new Semaphore(1, 1);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a model system model for a previous run.
 /// </summary>
 /// <param name="modelSystemEditingSession">The session to use</param>
 /// <param name="project">The project the previous run is in.</param>
 /// <param name="runFile">The path to the run file.</param>
 public ModelSystemModel(XTMFRuntime runtime, ModelSystemEditingSession modelSystemEditingSession, Project project, string runFile)
 {
     Project          = project;
     ModelSystemIndex = -1;
     Name             = Path.GetFileName(runFile);
     _Description     = "Previous run";
     Root             = new ModelSystemStructureModel(modelSystemEditingSession, runtime.ModelSystemController.LoadFromRunFile(runFile));
     LinkedParameters = new LinkedParametersModel(modelSystemEditingSession, this, new List <ILinkedParameter>());
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Create a model system model for a previous run.
 /// </summary>
 /// <param name="modelSystemEditingSession">The session to use</param>
 /// <param name="project">The project the previous run is in.</param>
 /// <param name="runFile">The path to the run file.</param>
 public ModelSystemModel(XTMFRuntime runtime, ModelSystemEditingSession modelSystemEditingSession, Project project, string runFile)
 {
     _Path             = runFile;
     _Project          = project;
     _ModelSystemIndex = -1;
     Name         = Path.GetFileName(runFile);
     _Description = "Previous run";
     LoadModelSystemFromFile(runtime, modelSystemEditingSession, runFile);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Clone the given model system with a new name
        /// </summary>
        /// <param name="root"></param>
        /// <param name="name"></param>
        /// <param name="error"></param>
        /// <returns></returns>
        public static bool CloneModelSystemAs(XTMFRuntime runtime, IModelSystemStructure root, List <ILinkedParameter> linkedParameters, string description, string name, ref string error)
        {
            var ms = runtime.ModelSystemController.LoadOrCreate(name);

            ms.Name                 = name;
            ms.Description          = description;
            ms.ModelSystemStructure = root;
            ms.LinkedParameters     = linkedParameters;
            var ret = ms.Save(ref error);

            // make sure we don't reuse any references
            ms.Unload();
            return(ret);
        }
Ejemplo n.º 10
0
 public ModelSystemController(XTMFRuntime runtime)
 {
     Runtime    = runtime;
     Repository = Runtime.Configuration.ModelSystemRepository as ModelSystemRepository;
 }
Ejemplo n.º 11
0
 public ProjectController(XTMFRuntime runtime)
 {
     Runtime = runtime;
 }