private void btnSaveCurves_Click(object sender, RoutedEventArgs e) { var include = GetDataTypesToInclude(); var hasErrors = false; if (include.Count > 0) { foreach (var experimentalRun in ExperimentalRuns) { foreach (var dataType in include) { try { var name = System.IO.Path.GetFileNameWithoutExtension(experimentalRun.ImportFileName); using (var sw = new StreamWriter(string.Format(CultureInfo.InvariantCulture, "{0}\\{1}_curves_{2}.tsv", txtOutputDirectory.Text, name, dataType))) sw.Write(experimentalRun.GetTabularDelimitedCurveOutput(dataType)); } catch (Exception ex) { MessageBox.Show(ex.Message); hasErrors = true; } } } if (!hasErrors) { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "{0} Experiment(s) was(were) successfully saved, for {1} selected type(s) of data.", ExperimentalRuns.Count(), include.Count)); } } else { MessageBox.Show("With the current selection there is nothing to save!"); } }
private void btnSave_Click(object sender, RoutedEventArgs e) { var hasErrors = false; foreach (var experimentalRun in ExperimentalRuns) { try { string name = System.IO.Path.GetFileNameWithoutExtension(experimentalRun.ImportFileName); using (var sw = new StreamWriter(string.Format(CultureInfo.InvariantCulture, "{0}\\{1}.tsv", txtOutputDirectory.Text, name))) sw.Write(experimentalRun.GetTabularDelimitedOutput()); } catch (Exception ex) { MessageBox.Show(ex.Message); hasErrors = true; } } if (!hasErrors) { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "{0} Experiment(s) was(were) successfully saved.", ExperimentalRuns.Count())); } }
private void btnSave_Click_MegaFile(object sender, RoutedEventArgs e) { var hasErrors = false; bool firstIteration = true; try { string name = "MasterJonas"; using (var sw = new StreamWriter(string.Format(CultureInfo.InvariantCulture, "{0}\\{1}.tsv", txtOutputDirectory.Text, name))) { foreach (var experimentalRun in ExperimentalRuns) { sw.Write(experimentalRun.GetTabularDelimitedOutputExperiment(firstIteration)); if (firstIteration) { firstIteration = false; } } } } catch (Exception ex) { MessageBox.Show(ex.Message); hasErrors = true; } if (!hasErrors) { MessageBox.Show(string.Format(CultureInfo.InvariantCulture, "{0} Experiment(s) was(were) successfully saved.", ExperimentalRuns.Count())); } }