private void mmnuCreateTIC_Click(object sender, System.EventArgs e) { try { var openFileDialog1 = new OpenFileDialog(); openFileDialog1.Filter = "Scans CSV File (*_scans.csv)|*.csv|ICR2LS TIC File (*.*)|*.tic"; openFileDialog1.FilterIndex = 1; openFileDialog1.RestoreDirectory = true; openFileDialog1.InitialDirectory = mobj_config.OpenDir; if (openFileDialog1.ShowDialog() == DialogResult.OK) { var file_name = openFileDialog1.FileName; var index = file_name.LastIndexOf("\\"); index++; var file_name_without_path = ""; if (index > 0) { file_name_without_path = file_name.Substring(index, file_name.Length - index); } var frmTIC = new frmTICViewer(); frmTIC.mFileName = file_name; frmTIC.mFileNameForHeader = file_name_without_path; switch (openFileDialog1.FilterIndex) { case 1: frmTIC.LoadScansTICFile(); break; case 2: frmTIC.LoadIcr2lsTICFile(); break; default: break; } mMediator.RequestFormOpen(frmTIC); } } catch (Exception ex) { Console.WriteLine(ex.Message + ex.StackTrace); } }
private void frmDecon2LS_DragDrop(object sender, System.Windows.Forms.DragEventArgs e) { foreach (var fileName in (string[])e.Data.GetData(DataFormats.FileDrop)) { var index = fileName.LastIndexOf("\\"); var path_dir = ""; if (index > 0) { path_dir = fileName.Substring(0, index); mobj_config.OpenDir = path_dir; } if (fileName.EndsWith("_scans.csv")) { index++; var file_name_without_path = ""; if (index > 0) { file_name_without_path = fileName.Substring(index, fileName.Length - index); } var frmTIC = new frmTICViewer(); frmTIC.mFileName = fileName; frmTIC.mFileNameForHeader = file_name_without_path; frmTIC.LoadScansTICFile(); mMediator.RequestFormOpen(frmTIC); } else if (fileName.EndsWith(".dat")) { var transformResults = new DeconToolsV2.Results.clsTransformResults(); transformResults.ReadResults(fileName); var frmTwoD = new frm2DPeakProcessing(transformResults); frmTwoD.HornTransformParameters = mobjTransformParameters; frmTwoD.PeakProcessorParameters = mobjPeakParameters; frmTwoD.FTICRPreProcessOptions = mobjFTICRRawPreProcessParameters; mMediator.RequestFormOpen(frmTwoD); } else if (fileName.EndsWith(".tic")) { index++; var file_name_without_path = ""; if (index > 0) { file_name_without_path = fileName.Substring(index, fileName.Length - index); } var frmTIC = new frmTICViewer(); frmTIC.mFileName = fileName; frmTIC.mFileNameForHeader = file_name_without_path; frmTIC.LoadIcr2lsTICFile(); mMediator.RequestFormOpen(frmTIC); } else { Console.WriteLine("File cannot be dragged and dropped"); } } }