Пример #1
0
        //Export sensor data to a .csv file
        private void exportData(object sender, RoutedEventArgs e)
        {
            FileStream fs;
            // Displays a SaveFileDialog so the user can save the export
            SaveFileDialog exportDialog = new SaveFileDialog();
            exportDialog.Filter = "Comma-seperated value|*.csv";
            exportDialog.Title = "Export graph data";
            exportDialog.ShowDialog();
            if (exportDialog.FileName != "")
            {
                // Saves the export via a FileStream created by the OpenFile method.
                if ((fs = (FileStream)exportDialog.OpenFile()) != null)
                {
                    // Code to write the stream goes here.
                    Exporter exporter = new Exporter(signals, exportDialog.FileName);
                    exporter.writeFileStream(fs);
                    fs.Close();
                }
            }

            
        }