Пример #1
0
 static public void ReviewProjectResources(string projectGUID)
 {
     SettingsContent.UpdateSettingsPath();
     ProjectsManager.ResetProjectManager();
     PackagesManager.ResetPackageManager();
     ProjectsManager.UpdateProjectItem();
     PackagesManager.UpdatePackageList();
     ProjectsManager.LoadProjectFile(ProjectsManager.projectList.projectFilePath[ProjectsManager.projectList.projectID.IndexOf(projectGUID)]);
     PackagesManager.LoadPackageFile(ProjectsManager.projectInfo.packageGUID);
     GraphicOptionsManager.LoadGraphicOptionsFile(ProjectsManager.projectInfo.simulatorOptionsFilePath);
     LoadTrainData(PackagesManager.packageInfo.packageTrainDir);
     PackagesManager.packageInfo.trainDetailInfoLoaded = false;
     LoadRouteData(PackagesManager.packageInfo.packageRouteDir);
     PackagesManager.packageInfo.routeDetailInfoLoaded = false;
 }
Пример #2
0
        static public void ProjectLoaderProcess(LoadingState processValue)
        {
            try
            {
                switch (processValue)
                {
                case LoadingState.WAIT_FOR_START:
                {
                    ProcessEvent(LoadingState.READY);
                    break;
                }

                case LoadingState.READY:
                {
                    //reset data
                    BoardsManager.ResetBoardManager();
                    ControlObjects.ResetControlObjects();
                    CommunicationSerial.ResetSerial();
                    DataManager.ResetTrainData();
                    PackagesManager.ResetPackageManager();
                    GraphicOptionsManager.ResetGraphicOptionsManager();
                    UserInterfaceSwap.errorContent.Clear();
                    RProxy.SimWorldTrigger.ResetTrigger();
                    ProcessEvent(LoadingState.DATA_RESET);
                    break;
                }

                case LoadingState.DATA_RESET:
                {
                    //update list
                    SettingsContent.UpdateSettingsPath();
                    BoardsManager.UpdateBoardItems();
                    ControlObjects.UpdateControlObjectsItem();
                    ProjectsManager.UpdateProjectItem();
                    PackagesManager.UpdatePackageList();
                    ProcessEvent(LoadingState.DATA_UPDATED);
                    break;
                }

                case LoadingState.DATA_UPDATED:
                {
                    //get project define file path
                    int fileIndex = ProjectsManager.projectList.projectID.IndexOf(projectGUIDValue);
                    projectFilePath = ProjectsManager.projectList.projectFilePath[fileIndex];
                    projectDirPath  = Path.GetDirectoryName(projectFilePath);
                    //load project define file
                    ProjectsManager.LoadProjectFile(projectFilePath);
                    ProjectsManager.SetupBoard();
                    ProjectsManager.SetupControlObjects();
                    DevicesManager.UpdateDevicesInitMode();
                    CommunicationSerial.InitializeSerial();
                    ProcessEvent(LoadingState.PROJECT_DEFINE_LOADED);
                    break;
                }

                case LoadingState.PROJECT_DEFINE_LOADED:
                {
                    //load package
                    PackagesManager.LoadPackageFile(ProjectsManager.projectInfo.packageGUID);
                    ProcessEvent(LoadingState.PACKAGE_DEFINE_LOADED);
                    break;
                }

                case LoadingState.PACKAGE_DEFINE_LOADED:
                {
                    //load train
                    PackagesManager.packageInfo.trainDetailInfoLoaded = false;
                    LoadTrainData(PackagesManager.packageInfo.packageTrainDir);
                    ProcessEvent(LoadingState.TRAIN_LOADED);
                    break;
                }

                case LoadingState.TRAIN_LOADED:
                {
                    //load route
                    PackagesManager.packageInfo.routeDetailInfoLoaded = false;
                    routeLoadingStateMonitor.AttachMainTimerInterrupt();
                    routeLoadingStateMonitor.MainTimerEnable = true;
                    LoadRouteData(PackagesManager.packageInfo.packageRouteDir);
                    break;
                }

                case LoadingState.ROUTE_LOADED:
                {
                    //load options
                    GraphicOptionsManager.LoadGraphicOptionsFile(ProjectsManager.projectInfo.simulatorOptionsFilePath);
                    GraphicOptionsLoaderEvent(GraphicOptionsManager.graphicOptionsValue);
                    ProcessEvent(LoadingState.SIM_OPTIONS_LOADED);
                    break;
                }

                case LoadingState.SIM_OPTIONS_LOADED:
                {
                    //check error
                    UserInterfaceSwap.errorContent = ProjectsManager.CheckProjectContent();
                    ProcessEvent(LoadingState.DATA_SERVER_START);
                    break;
                }

                case LoadingState.DATA_SERVER_START:
                {
                    //starting server
                    ProjectsManager.SetupDataServer();
                    ProcessEvent(LoadingState.DONE);
                    break;
                }

                case LoadingState.DONE:
                {
                    CommunicationNetwork.StartWebSocketServer();
                    StartSimulatorEvent();
                    break;
                }
                }
            }
            catch (Exception)
            {
                ProcessEvent(LoadingState.ERROR);
            };
        }