/// <summary> /// Saves the SFC diagram to a file /// </summary> public void SaveDiagram() { string filepath = OpenedLesson.CustomDiagramFilePath; Error result = Sfc2dEditorNode.SaveDiagram(filepath); GetNode <EditorControls>(EditorControlsPath).OnSaveDiagram(result); }
/// <summary> /// Loads the file and builds the SFC diagram if the file exists. /// </summary> public void TryLoadDiagram() { string filepath = OpenedLesson.CustomDiagramFilePath; if (string.IsNullOrEmpty(filepath)) { filepath = OpenedLesson.FolderPath + LessonEntity.UserResultDirectory + "/Diagram.sfc"; OpenedLesson.CustomDiagramFilePath = filepath; } Sfc2dEditorNode.TryLoadDiagram(filepath); GetNode <EditorControls>(EditorControlsPath).OnLoadDiagram(); }
/// <summary> /// Initializes the whole page. Called before the node is added to the tree by the lesson controller. /// </summary> public override void InitialiseWith(IMainNode mainNode, ILessonEntity openedLesson) { MainNode = mainNode; OpenedLesson = openedLesson; LessonView = GetNode <LessonView>(LessonViewPath); LessonView.LoadAndShowInfo(openedLesson); Sfc2dEditorNode = GetNode <Sfc2dEditorNode>(Sfc2dEditorPath); HelpPage = GetNode <HelpPage>(EditorHelpPath); ProcessingData data = new ProcessingData { InputRegisters = new StateTable(LessonView.PlantView.LoadedSimulationNode.SimulationOutput), OutputRegisters = new StateTable(LessonView.PlantView.LoadedSimulationNode.SimulationInput) }; Sfc2dEditorNode.InitializeEditor(data, true); TryLoadDiagram(); }
/// <summary> /// Saves the data to a temporary file which is always written when the scene changes /// </summary> public void SerialiseToTemp() { Sfc2dEditorNode.SaveDiagram(OpenedLesson.TemporaryDiagramFilePath); }