Exemplo n.º 1
0
 private void outputWindowToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (!FormManager.IsOutputWindowOpen())
     {
         m_formOutputWindow = new FormOutputWindow();
         m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);
         FormManager.AddOutputWindow(m_formOutputWindow);
     }
 }
Exemplo n.º 2
0
        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;
        }