示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            CalibrationCurveList list = new CalibrationCurveList();

            foreach (ListViewItem lvi in listView1.Items)
            {
                if (lvi.Selected)
                {
                    list.Add((DoublesDclMass)lvi.Tag);
                    lvi.Selected = false;
                }
            }
            if (list.Count < 1)
            {
                return;
            }
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "CSV files (.csv)|*.csv|                 (.txt)| *.txt";
            dlg.DefaultExt       = ".csv";
            dlg.FileName         = Material + AnalysisMethod.FullName() + ".csv";
            dlg.InitialDirectory = N.App.AppContext.ResultsFilePath;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                using (StreamWriter w = new StreamWriter(dlg.FileName))
                {
                    foreach (DoublesDclMass x in list)
                    {
                        w.WriteLine(x.ToString());
                    }
                    w.Close();
                }
            }
        }
示例#2
0
        private void OKBtn_Click(object sender, EventArgs e)
        {
            CalibrationCurveList list = new CalibrationCurveList();

            foreach (ListViewItem lvi in listView1.Items)
            {
                if (lvi.Selected)
                {
                    list.Add((DoublesDclMass)lvi.Tag);
                    lvi.Selected = false;
                }
            }
            SaveCurveXYValues(list);
            Close();
        }
示例#3
0
        void SaveCurveXYValues(CalibrationCurveList list)
        {
            CalcDataList = new CalibrationCurveList();
            if (list.Count < 1)
            {
                return;
            }

            // save the data-points for use in the Get file op that replaces the deming
            System.Collections.IEnumerator _iter = list.GetEnumerator();
            while (_iter.MoveNext())
            {
                DoublesDclMass dl = (DoublesDclMass)_iter.Current;
                CalcDataList.Add(dl);
            }
            CalcDataList.CalcLowerUpper();                              // compute upper and lower mass limits from the data points,

            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Filter           = "DMD files (*.dmd)|*.dmd|in files (*.in)|*.in|All files (*.*)|*.*";
            dlg.DefaultExt       = ".in";
            dlg.FileName         = "deming.in";
            dlg.InitialDirectory = N.App.AppContext.ResultsFilePath;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    StreamWriter tx = File.CreateText(dlg.FileName);
                    System.Collections.IEnumerator iter = list.GetEnumerator();
                    while (iter.MoveNext())
                    {
                        string entry = iter.Current.ToString();
                        tx.WriteLine(entry);
                    }
                    tx.Close();
                    N.App.Loggers.Logger(LMLoggers.AppSection.Control).TraceInformation("Fitting data written to " + dlg.FileName);
                } catch (IOException ex)
                {
                    MessageBox.Show(ex.Message, "Error on " + dlg.FileName);
                }
            }
        }