示例#1
0
        /// <summary>
        /// <para>Configures the PTU application using the specified data dictionary. The configuration procedure is as follows:</para>
        /// <para>(1) updates the <c>Parameter</c> class;</para>
        /// <para>(2) updates the Lookup static class to allow the records contained within the primary key data tables of the data dictionary to be accessed;</para> 
        /// <para>(3) creates the application data sub-directories if they do not exist;</para>
        /// <para>(4) updates the main menu options to reflect the current project and security level;</para>
        /// <para>(5) updates the file header information;</para>
        /// <para>(6) loads the default worksets associated with the specified data dictionary, if they exist;</para>
        /// <para>(7) loads the help file associated with the current project and software version;</para>
        /// <para>(8) shows the 'Help/About' screen.</para>
        /// </summary>
        /// <param name="dataDictionary">The data dictionary that is to be used to configure the PTU.</param>
        /// <exception cref="ArgumentNullException">Thrown if <paramref name="dataDictionary"/> is null.</exception>
        public void LoadDictionary(DataDictionary dataDictionary)
        {
            Debug.Assert(dataDictionary != null, "MdiPTU.Support.LoadDictionary - [dataDictionary != null]");

            // The configuration file was OK, initialize the Parameter class.
            Parameter.Initialize(dataDictionary);

            // Check whether the project identifier was passed as a shortcut parameter.
            if (m_ProjectIdentifierPassedAsParameter.Equals(string.Empty))
            {
                // No, initialize the project specific features of the PTU application.
                InitializePTUProjectSpecific(Parameter.ProjectInformation.ProjectIdentifier);

                // Update the member variable that records the project-identifier that was passed as a parameter with the project-identifier associated with the
                // selected configuration file.
                m_ProjectIdentifierPassedAsParameter = Parameter.ProjectInformation.ProjectIdentifier;
            }
            else
            {
                // Check whether the data dictionary matches the project identifier that was passed as a shortcut parameter.
                if (Parameter.ProjectInformation.ProjectIdentifier != m_ProjectIdentifierPassedAsParameter)
                {
                    MessageBox.Show(Resources.MBTConfigProjectAsParameterMismatch, Resources.MBCaptionError, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Close();
                    return;
                }
            }

            Lookup.Initialize(dataDictionary);

            InitializeDataSubDirectories();

            // Initialize the system security and set the security clearance to the base level.
            Security.Initialize();
            m_Security = new Security();
            ShowSecurityLevelChange(m_Security);

            // Update the FileHeader.HeaderCurrent property with the parameter values that are currently known.
            Header_t header = new Header_t();
            FileHeader.Initialize(ref header);
            header.ProjectInformation = Parameter.ProjectInformation;
            FileHeader.HeaderCurrent = header;

            SetMode(Mode.Configuration);
            LoadAllWorksetCollections(Parameter.ProjectInformation.ProjectIdentifier);
            LoadHelpFile(Parameter.ProjectInformation.Version, Parameter.ProjectInformation.ProjectIdentifier);

            // If applicable to the current project, show the splash screen.
            switch (m_ProjectIdentifierPassedAsParameter)
            {
                case CommonConstants.ProjectIdNYCT:
                    // Do not show the splash screen for the R188 project.
                    break;
                default:
                    // Show the splash screen.
                    using (FormHelpAbout formHelpAbout = new FormHelpAbout(Resources.ProductNamePTU))
                    {
                        formHelpAbout.ShowDialog();
                    }
                    break;
            }
        }
        /// <summary>
        /// Show the splash screen.
        /// </summary>
        public void HelpAbout()
        {
            // Determine the filename of the help document associated with this project.
            string productName;
            switch (Parameter.ProjectInformation.ProjectIdentifier)
            {
                case CommonConstants.ProjectIdNYCT:
                    productName = Resources.ProductNamePTE;
                    break;
                default:
                    productName = Resources.ProductNamePTU;
                    break;
            }

            MainWindow.Cursor = Cursors.WaitCursor;
            try
            {
                FormHelpAbout formHelpAbout = new FormHelpAbout(productName);
                MainWindow.ShowDialog(formHelpAbout);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message, Resources.MBCaptionInformation, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            finally
            {
                MainWindow.Cursor = Cursors.Default;
            }
        }