예제 #1
0
        bool StartConfig()
        {
            bool?success;

            // Step 1 - Config path to iS3 and data directory
            //
            ConfPathWindow mainWnd = new ConfPathWindow();

            success = mainWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            iS3Path  = mainWnd.ExePath;
            dataPath = mainWnd.DataPath;

            // Step 2 - Config projects
            //
            string         projListFile = dataPath + "\\ProjectList.xml";
            ProjectsWindow projsWnd     = new ProjectsWindow(projListFile);

            success = projsWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            projID   = projsWnd.ProjID;
            projLocX = projsWnd.ProjLocX;
            projLocY = projsWnd.ProjLocY;

            // Step 3.1 - Config project general definition
            //
            ProjGnrDefWindow projGnrDefWnd = new ProjGnrDefWindow(projID, dataPath);

            success = projGnrDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            ProjectDefinition projDef = projGnrDefWnd.ProjDef;

            // Step 3.2 - Config project engineering maps definition
            //
            ProjEMapDefWindow projEMapsDefWnd = new ProjEMapDefWindow(projDef);

            success = projEMapsDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }

            return(true);
        }
예제 #2
0
        bool StartConfig()
        {
            bool?success;

            // Preparation Step 1 - Config path to iS3 and data directory
            //
            ConfPathWindow mainWnd = new ConfPathWindow();

            mainWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            success = mainWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            iS3Path  = mainWnd.ExePath;
            dataPath = mainWnd.DataPath;

            // Preparation Step 2 - Config projects
            //
            string         projListFile = dataPath + "\\ProjectList.xml";
            ProjectList    projList     = ConfigCore.LoadProjectList(projListFile);
            ProjectsWindow projsWnd     = new ProjectsWindow(projList);

            projsWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            success = projsWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            projID   = projsWnd.ProjID;
            projLocX = projsWnd.ProjLocX;
            projLocY = projsWnd.ProjLocY;

            // Step 1 - Config project general definition
            //
            ProjectDefinition projDef = ConfigCore.LoadProjectDefinition(dataPath, projID);

            if (projDef == null)
            {
                projDef = ConfigCore.CreateProjectDefinition(dataPath, projID);
            }
            ProjGnrDefWindow projGnrDefWnd = new ProjGnrDefWindow(projDef);

            projGnrDefWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            success = projGnrDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }

            // Step 2 - Config engineering maps definition of the project
            //
            ProjEMapDefWindow projEMapsDefWnd = new ProjEMapDefWindow(projDef);

            projEMapsDefWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            success = projEMapsDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }
            //Step 3.3 -Config 3d map
            //
            Proj3DDefWindow proj3DDefWindow = new Proj3DDefWindow(projDef);

            success = proj3DDefWindow.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }

            // Config 3D map
            //      Note: Because there is nothing to configure for 3D, add "preview 3D model" in DomainDefWindow
            //
            //Proj3DViewDefWindow proj3DViewDefWnd = new Proj3DViewDefWindow(dataPath, projID);
            //proj3DViewDefWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            //success = proj3DViewDefWnd.ShowDialog();
            //if (success == null || success.Value == false)
            //{
            //    return false;
            //}

            // Step 3 - Config domains of the project
            //
            List <EMapLayers> eMapLayersList = projEMapsDefWnd.EMapLayersList;
            UnityLayer        unitylayer     = proj3DDefWindow.unityLayer;
            Project           prj            = ConfigCore.LoadProject(dataPath, projID);
            DomainDefWindow   domainDefWnd   = new DomainDefWindow(projDef, prj, eMapLayersList, unitylayer);

            domainDefWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;

            success = domainDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }

            // Step 4 - Config project tree
            //
            ProjTreeDefWindow prjTreeDefWnd = new ProjTreeDefWindow(prj);

            prjTreeDefWnd.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            success = prjTreeDefWnd.ShowDialog();
            if (success == null || success.Value == false)
            {
                return(false);
            }

            // Write ProjectList.xml
            //
            ConfigCore.WriteProjectList(projListFile, projsWnd.ProjectList);

            // Write <projectID>.xml
            //
            ConfigCore.WriteProject(dataPath, projID, projDef, prj);

            // Write <projectID>.py
            //
            ConfigCore.WriteViewsDef(iS3Path, projID, projDef);

            string format =
                "Congratulations!\r\n" +
                "The following files has been generated successfully.\r\n" +
                "    {0}\\ProjectList.xml\r\n" +
                "    {1}\\{2}.xml\r\n" +
                "    {3}\\IS3Py\\{4}.py\r\n" +
                "The {5} project is ready to use in iS3.";

            string str = string.Format(format, dataPath, dataPath, projID, iS3Path, projID, projID);

            MessageBox.Show(str, "Success", MessageBoxButton.OK);

            return(true);
        }