Ejemplo n.º 1
0
        private void btnNewCsv_Click(object sender, RoutedEventArgs e)
        {
            var myDoc = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            var fileName = "GameStats_" +
                           DateTime.Now.ToString()
                           .Replace("\\", "_")
                           .Replace("/", "_")
                           .Replace(" ", "_")
                           .Replace(":", "_");

            var path = System.IO.Path.Combine(myDoc, fileName);

            path = System.IO.Path.ChangeExtension(path, ".csv");



            try
            {
                CsvImporter.CreateTemplate(path);
                this.CsvPath = path;
                System.Diagnostics.Process.Start(path);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }