예제 #1
0
        void BeginValidation()
        {
            if (listBoxFont.Items.Count == 0)
            {
                MessageBox.Show(this, "No fonts to validate!\r\nYou must first add one or more fonts to the font file list.");
            }
            else
            {
                // disable the ui during validation

                EnableUI(false);


                try
                {
                    // tell the validator which tests to perform

                    for (int i=0; i<checkedListBoxTests.Items.Count; i++)
                    {
                        string sTable = checkedListBoxTests.Items[i].ToString();
                        bool bPerform = checkedListBoxTests.GetItemChecked(i);
                        m_Validator.SetTablePerformTest(sTable, bPerform);
                    }

                    if (checkBoxRast.Checked)
                    {
                        m_Validator.SetRastPerformTest(checkBoxBW.Checked, checkBoxGray.Checked, checkBoxClearType.Checked,
                            checkBoxCTCompWidth.Checked, checkBoxCTVert.Checked, checkBoxCTBGR.Checked, checkBoxCTFractWidth.Checked);
                    }
                    else
                    {
                        m_Validator.SetRastPerformTest(false, false, false, false, false, false, false);
                    }
                    int x = Int32.Parse(textBoxXRes.Text);
                    int y = Int32.Parse(textBoxYRes.Text);
                    int [] pointsizes = ParseRastPointSizes();
                    
                    m_Validator.SetRastTestParams(x, y, pointsizes, m_RastTestTransform);


                    // put up the progress dialog which will manage the validation

                    string [] sFiles = new string[listBoxFont.Items.Count];
                    for (int i=0; i<listBoxFont.Items.Count; i++)
                    {
                        sFiles[i] = listBoxFont.Items[i].ToString();
                    }
                    m_formProgress = new Progress(this, m_Validator, sFiles, 
                        m_PersistedData.m_ReportFileDestination,
                        m_PersistedData.m_bOpenReportFile,
                        m_PersistedData.m_sReportFixedDir);
                    m_formProgress.TopLevel = false;
                    m_formProgress.Parent = this;
                    m_formProgress.BringToFront();
                    // centering isn't working with the current .Net framework, so force it to be centered
                    //m_formProgress.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
                    m_formProgress.SetBounds(Width/2 - m_formProgress.Width/2, Height/2 - m_formProgress.Height/2,
                        m_formProgress.Width, m_formProgress.Height, BoundsSpecified.Location);

                    m_formProgress.Show();
                }
                catch (Exception e)
                {
                    MessageBox.Show(this, e.Message, "Error");
                    EnableUI(true);
                }
            }
        }