示例#1
0
        private void bBrowseQueriesVerification_Click(object sender, EventArgs e)
        {
            OpenFileDialog opd = new OpenFileDialog();

            opd.Filter = "Query files (*.kpq)|*.kpq";
            if (opd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string kpxFileName = opd.FileName;
                tbQueriesVerification.Text = opd.FileName;
                string[]   lines        = File.ReadAllLines(opd.FileName);
                Experiment kpExperiment = null;
                if (!string.IsNullOrEmpty(kpxFileName))
                {
                    if (new FileInfo(kpxFileName).Exists)
                    {
                        try
                        {
                            kpExperiment = KP.FromKpx(kpxFileName);
                        }
                        catch (Exception exception)
                        {
                            throw new Exception(string.Format("Failed to parse input file {0}. Reason: {1}", kpxFileName, exception.Message));
                        }
                    }
                    else
                    {
                        throw new Exception(string.Format("File '{0}' does not exist. Please specify a valid experiment file.", kpxFileName));
                    }
                }
                properties.Load(new List <string>(lines), kpExperiment);
            }
        }