Пример #1
0
        private void FormImageView3_Load(object sender, EventArgs e)
        {
            if (m_bClose)
            {
                this.Close();
                return;
            }
            this.Text = "RoadCare ImageView:Loading...";
            m_formSolutionExplorer = new FormImageViewSolutionExplorer();
            m_formOutputWindow     = new FormOutputWindow();
            m_formNavigation       = new FormNavigation();

            OutputWindow.Output = m_formOutputWindow;
            FormManager.AddOutputWindow(m_formOutputWindow);

            m_formOutputWindow.CloseButton = false;

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

            strMyDocumentsFolder += "\\RoadCare Projects\\ImageView\\Temp";
            Settings.Default.IMAGEVIEW_FILEPATH = strMyDocumentsFolder;

            // Add the explution soLOLar and the output window to the main dock panel if we do not have a previous settings file.
            String strFile = strMyDocumentsFolder + "\\TAB_SETTINGS.xml";

            if (!File.Exists(strFile))
            {
                m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);

                int nWidth    = m_formSolutionExplorer.Width;
                int nAppWidth = this.Width;


                m_formNavigation.Show(dockPanelMain, new Rectangle(nWidth, 40, nAppWidth - nWidth, 80));
            }
            else
            {
                // Load the tab settings (and other user settings?) from the XML file
                try
                {
                    DeserializeDockContent deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
                    dockPanelMain.LoadFromXml(strFile, deserializeDockContent);

                    if (!m_formSolutionExplorer.Visible)
                    {
                        m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                    }
                }
                catch (Exception exc)
                {
                    m_formSolutionExplorer.Show(dockPanelMain, DockState.DockLeft);
                    m_formOutputWindow.Show(dockPanelMain, DockState.DockBottom);
                    OutputWindow.WriteOutput("Error: Problem processing TAB_SETTINGS.xml file. " + exc.Message);
                }
            }
            OutputWindow.DockPanel      = dockPanelMain;
            m_formNavigation.Navigation = new NavigationObject(ImageViewManager.Networks);

            if (String.IsNullOrEmpty(m_formNavigation.Navigation.ImagePath))
            {
                String strImagePath = Settings.Default.IMAGEPATH;
                if (String.IsNullOrEmpty(strImagePath))
                {
                    if (folderBrowserDialogImagePath.ShowDialog() == DialogResult.OK)
                    {
                        strImagePath = folderBrowserDialogImagePath.SelectedPath;
                        Settings.Default.IMAGEPATH = strImagePath;
                    }
                }
                m_formNavigation.Navigation.ImagePath = strImagePath;
            }

            this.Text = "RoadCare ImageView:" + DBMgr.GetNativeConnection().Database;
        }