예제 #1
0
        private void AddEtanFilesButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = @"C:\Users\ConraN01\Documents\Spyder_WS\MRI_RF_TF_Tool_Project\Test Files for Python Utility\Input Etan mat files";
            ofd.Filter           = "Matlab MAT (*.mat)|*.mat|All Files (*.*)|*.*";
            ofd.Title            = "Select Etan files...";
            ofd.Multiselect      = true;
            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            if (ofd.FileNames.Length == 0)
            {
                MessageBox.Show(this, "No files selected", "TF Reading Error");
                return;
            }
            try {
                List <ETan> newETanData = new List <ETan>();
                foreach (string f in ofd.FileNames)
                {
                    ETan etan = new ETan(f);
                    newETanData.Add(etan);
                }
                foreach (ETan x in ETanFilesListBox.Items)
                {
                    newETanData.RemoveAll(y => y.filename == x.filename);
                }
                ETanFilesListBox.Items.AddRange(newETanData.ToArray());
                RefreshSummaryRows();
            }
            catch (Exception ex) {
                MessageBox.Show(this, "TF File could not be opened!\n\n" + ex.Message,
                                "Error loading TF file",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
 public void RefreshSummaryRows()
 {
     if (meassum == null)
     {
         foreach (ETan x in ETanFilesListBox.Items)
         {
             x.summrow = null;
         }
     }
     else
     {
         for (int i = 0; i < ETanFilesListBox.Items.Count; i++)
         {
             ETan x = (ETan)ETanFilesListBox.Items[i];
             List <MeasSummary.SummaryRow> row =
                 meassum.rows.FindAll(r => r.Pathway.ToLowerInvariant() == x.PathWay.ToLowerInvariant());
             if (row != x.summrow)
             {
                 x.summrow = row;
                 ETanFilesListBox.Items[i] = x;
             }
         }
     }
 }