コード例 #1
0
ファイル: FormRoadCare.cs プロジェクト: jakedw7/iAM
        public FormRoadCare()
        {
            InitializeComponent();

            var formLogin = new FormLogin();

            var now = DateTime.Now;

            if (now >= Global.ExactMomentWhenLicenseExpires)
            {
                MessageBox.Show(
                    "License has expired.  Please contact Applied Research Associates to renew.",
                    Global.BrandCaptionForMessageBoxes,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Error);

                Environment.Exit(0);
            }

            if (now >= Global.FirstDayOfLicenseExpirationWarning)
            {
                MessageBox.Show(
                    $"Warning: License expires {Global.LastDayOfLicense}.  Please contact Applied Research Associates to renew.",
                    Global.BrandCaptionForMessageBoxes,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
            }

            var strFile = "";

#if MDSHA
            AuthenticationResult loginAttempt = MDSHAAuthentication.Authenticate(Global.SecurityOperations);
            if (loginAttempt.Successful)
#endif
            if (formLogin.ShowDialog() == DialogResult.OK)
            {
                // DBOps will use the provider to determine SQL syntax.
                DBOp.Provider = DBMgr.NativeConnectionParameters.Provider;
                // Show the Output Window
                m_formOutputWindow = new FormOutputWindow();
                FormManager.AddOutputWindow(m_formOutputWindow);

                // Show the solution explorer
                m_solutionExplorer         = new SolutionExplorer(ref dockPanelMain);
                m_solutionExplorer.TabText = "RoadCare Explorer";
                FormManager.AddSolutionExplorer(m_solutionExplorer);

                String myDocumentsFolder = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

                String projectsDirectory = myDocumentsFolder + "\\RoadCare Projects";
                if (!Directory.Exists(projectsDirectory))
                {
                    Directory.CreateDirectory(projectsDirectory);
                }


                myDocumentsFolder += "\\RoadCare Projects\\Temp";

                Settings.Default.ROADCARE_FILE_PATH = myDocumentsFolder;

                // Add the explution soLOLar and the output window to the main dock panel if we do not have a previous settings file.
                strFile = myDocumentsFolder + "\\TAB_SETTINGS.xml";
                if (!File.Exists(strFile))
                {
                    m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);
                    m_solutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                }
                else
                {
                    // Load the tab settings (and other user settings?) from the XML file
                    try
                    {
                        DeserializeDockContent deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                        dockPanelMain.LoadFromXml(strFile, deserializeDockContent);
                    }
                    catch (Exception exc)
                    {
                        Global.WriteOutput("Error: Problem processing TAB_SETTINGS.xml file. " + exc.Message);
                    }
                }
                if (FormManager.GetOutputWindow().Visible == false)
                {
                    m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);
                }
                this.Text = "DSS RoadCare:" + DBMgr.GetNativeConnection().Database.ToString();
                if (!Global.SecurityOperations.CanLoadBinaries())
                {
                    loadBinariesToolStripMenuItem.Enabled = false;
                }
            }
            else
            {
                m_bIsCancelled = true;
#if MDSHA
                //MessageBox.Show( loginAttempt.Message );
#else
#endif
            }
            return;
        }
コード例 #2
0
 public static void AddSolutionExplorer(SolutionExplorer form)
 {
     m_formSolutionExplorer = form;
 }
コード例 #3
0
        private void AddReportGenerationWork(
            BackgroundWorker bw,
            string networkId,
            string networkName,
            string simulationId,
            string simulationName)
        {
            WorkCompleted = false;

            bw.WorkerReportsProgress                            = true;
            bw.ProgressChanged                                 += (sender, e) =>
                                                  WorkCompleted = (bool)e.UserState;

            try
            {
                // Configurable Input Summary
                if (WorkingReportName == Cis.Report.GenericTitle)
                {
                    var r = new Cis.Report(simulationId, simulationName);
                    var f = new FormConfigurableInputSummary(r);

                    f.ShowDialog();
                    if (f.IsReportReady)
                    {
                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // FY Targets & Suggested Projects
                else if (WorkingReportName == Fytsp.Report.GenericTitle)
                {
                    var b = new Fytsp.Report.Builder(
                        networkId,
                        simulationId,
                        simulationName);

                    var f = new FormFyTargetsSuggestedProjects(b);

                    f.ShowDialog();
                    if (f.IsReportReady)
                    {
                        var r = f.Report;
                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // LM DM VMT Condition (Dual Report)
                else if (WorkingReportName == Ldvc.Report.GenericTitle)
                {
                    var r = new Ldvc.Report(
                        networkId,
                        networkName,
                        simulationId,
                        simulationName);

                    var f = new FormLmDmVmtConditionDualReport(r);

                    f.ShowDialog();
                    if (f.IsReportReady)
                    {
                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // Budget & LM per FC per Year
                else if (WorkingReportName == Blfy.Report.GenericTitle)
                {
                    var result = fbdSimpleGen.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        var r = new Blfy.Report(
                            networkId,
                            simulationId,
                            simulationName);

                        r.OutputDirectory =
                            new DirectoryInfo(fbdSimpleGen.SelectedPath);

                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // Budget & LM per FC per Condition
                else if (WorkingReportName == Blfc.Report.GenericTitle)
                {
                    var result = fbdSimpleGen.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        var r = new Blfc.Report(
                            networkId,
                            simulationId,
                            simulationName);

                        r.OutputDirectory =
                            new DirectoryInfo(fbdSimpleGen.SelectedPath);

                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // IRI Condition per FC
                else if (WorkingReportName == Icf.Report.GenericTitle)
                {
                    var result = fbdSimpleGen.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        var r = new Icf.Report(
                            networkId,
                            simulationId,
                            simulationName);

                        r.OutputDirectory =
                            new DirectoryInfo(fbdSimpleGen.SelectedPath);

                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // All Sections
                else if (WorkingReportName == AllSec.Report.GenericTitle)
                {
                    var result = fbdSimpleGen.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        var r = new AllSec.Report(
                            networkId,
                            simulationId,
                            simulationName);

                        r.OutputDirectory =
                            new DirectoryInfo(fbdSimpleGen.SelectedPath);

                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                // Benefit/Cost Ratio
                else if (WorkingReportName == BenefitCostRatioReport.GenericTitle)
                {
                    var result = fbdSimpleGen.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        var r = new BenefitCostRatioReport(
                            networkId,
                            simulationId,
                            simulationName);

                        r.OutputDirectory =
                            new DirectoryInfo(fbdSimpleGen.SelectedPath);

                        bw.DoWork += (sender, e) =>
                                     bw.ReportProgress(100, TryGenerate(r));
                    }
                }
                else
                {
                    // Reports that existed prior to Spring/Summer 2014
                    bw.DoWork += (sender, e) =>
                                 SolutionExplorer.GenerateReport(
                        WorkingReportName,
                        networkId,
                        simulationId,
                        networkName,
                        simulationName);
                }
            }
            catch (ReportGenerationException e)
            {
                Global.WriteOutput(e.Message);
            }
        }
コード例 #4
0
 public static void RemoveSolutionExplorer(SolutionExplorer form)
 {
     m_formSolutionExplorer.Dispose();
     m_formSolutionExplorer = null;
 }