Example #1
0
        private void SaveTestWorkspaceData(TestWorkspace testWorkspace)
        {
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Indent = true;
            string    workspaceName          = testWorkspace.ToString();
            XmlWriter xmlTestWorkspaceWriter = XmlWriter.Create(
                GetWorkspaceInfoFilePath(workspaceName), xmlSettings);

            //-------------------------------------------------------------------
            xmlTestWorkspaceWriter.WriteStartElement("body");

            xmlTestWorkspaceWriter.WriteStartElement("FunctionType");
            xmlTestWorkspaceWriter.WriteValue(testWorkspace.functionType.ToString());
            xmlTestWorkspaceWriter.WriteEndElement();

            xmlTestWorkspaceWriter.WriteStartElement("SimulationTime");
            xmlTestWorkspaceWriter.WriteValue(testWorkspace.GetSimulationTime());
            xmlTestWorkspaceWriter.WriteEndElement();

            xmlTestWorkspaceWriter.WriteStartElement("ModelRunningTime");
            xmlTestWorkspaceWriter.WriteValue(testWorkspace.GetModelRunningTime());
            xmlTestWorkspaceWriter.WriteEndElement();

            switch (testWorkspace.functionType)
            {
            case FunctionTypeEnum.Continuous_Controller:
                SaveCCTestWorkspaceData((CCTestWorkspace)testWorkspace,
                                        xmlTestWorkspaceWriter);
                SettingFilesManager.SaveCCSettings(GetWorkspacePath(workspaceName),
                                                   ((CCTestWorkspace)testWorkspace).ccSettings);
                SettingFilesManager.SaveAdvancedCCSettings(GetWorkspacePath(workspaceName),
                                                           ((CCTestWorkspace)testWorkspace).advancedCCSettings);
                break;

            case FunctionTypeEnum.State_Based_Controller:
                break;

            case FunctionTypeEnum.Input_Output:
                break;
            }

            xmlTestWorkspaceWriter.WriteEndElement();
            xmlTestWorkspaceWriter.Close();
            return;
        }