Exemple #1
0
        public void PairedResultChanged(object sender, PairedResultChangedEventArgs e)
        {
            this.allResults = e.PairedResult;

            this.allFiles = e.ItemList;

            InitializeGraphics();

            InitializeFileColumns();

            InitializeCompoundList();
        }
        private void mnuOpenMrms_Click(object sender, EventArgs e)
        {
            if (this.pairedResults != null && this.pairedResults.Any(m => m.Modified))
            {
                var res = MessageBox.Show("Data changed, do you want to save the changes?", "Warning", MessageBoxButtons.YesNoCancel);
                if (res == System.Windows.Forms.DialogResult.Yes)
                {
                    mnuSaveChanges.PerformClick();
                }
                else if (res == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
            }

            var selectForm = new MrmSelectFileForm();

            if (selectForm.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                var filenames = selectForm.SelectedMrmFiles;

                this.pairedResults = new List <SrmPairedResult>();

                var format = new SrmPairedResultXmlFormat();
                try
                {
                    btnClose.Enabled    = false;
                    mnuClose.Enabled    = false;
                    btnOpenMrms.Enabled = false;
                    mnuOpenMrms.Enabled = false;

                    for (int i = 0; i < filenames.Length; i++)
                    {
                        var filename = filenames[i];

                        lblProgress.Text = MyConvert.Format("Reading MRM Scans {0}/{1} - {2}", i + 1, filenames.Length, filename);
                        lblProgress.Update();

                        var pr = format.ReadFromFile(filename);

                        //if (pr.Options.RatioByArea != RatioByArea)
                        //{
                        //  pr.Options.RatioByArea = RatioByArea;
                        //  pr.CalculateRatio();
                        //  pr.Modified = true;
                        //}

                        pr.Options.ValidationSoftware = this.Text;

                        this.pairedResults.Add(pr);
                    }
                    lblProgress.Text = "Finished.";
                }
                finally
                {
                    btnClose.Enabled    = true;
                    mnuClose.Enabled    = true;
                    btnOpenMrms.Enabled = true;
                    mnuOpenMrms.Enabled = true;
                }

                this.files = new SrmFileItemList(this.pairedResults, 0.01);

                InitializeFileModeTabPages();

                InitializeCompundModeFileColumns();

                InitializeCompoundGraphics();

                InitializeCompoundList();

                DoDataChanged(false);
            }
        }