private void _niInterface_CompletedSamples(object sender, CompletedSamplesEventArgs e)
        {
            Console.WriteLine("geto");

            string localFileSuffix = _fileSuffix;

            using (
                TextWriter textWriter =
                    File.CreateText(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\KCF Technologies\\Gauss Master\\" + FileNamePrefix + "_" + DateTime.Now.Ticks + "_" + localFileSuffix + ".csv"))
            {
                PrecisionDateTime startTime = e.Samples.ElementAt(0).DateTime;

                foreach (Sample sample in e.Samples)
                {
                    textWriter.WriteLine(sample.DateTime.TimeOfDay + "," + sample.Value + "," +
                                         sample.DateTime.Subtract(startTime).FractionalSeconds);
                }
            }

            _waitForSamples = false;
        }
        private void _niInterface_CompletedSamples(object sender, CompletedSamplesEventArgs e)
        {
            AcquisitionStatus = "Writing Samples";

            string localFileSuffix = _fileSuffix;

            string path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) +
                              "\\KCF Technologies\\Sample Master\\";

            Directory.CreateDirectory(path);

            using (TextWriter textWriter = File.CreateText(path + FileNamePrefix + "_" + DateTime.Now.Ticks + "_" + localFileSuffix + ".csv"))
            {
                //PrecisionDateTime startTime = e.Samples.ElementAt(0).DateTime;
                double sampleTimeInterval = (double)1 / (double)Convert.ToInt32(Properties.Settings.Default.SampleFrequency);
                double sampleTime = 0;
                //textWriter.WriteLine(startTime.FractionalSeconds);
                foreach (Sample sample in e.Samples)
                {
                    textWriter.WriteLine(sampleTime +","+  sample.Value);
                    sampleTime += sampleTimeInterval;
                }
            }

            _waitForSamples = false;
        }
예제 #3
0
 protected void OnCompletedSamples(CompletedSamplesEventArgs e)
 {
     if (CompletedSamples != null)
         CompletedSamples(this, e);
 }