ExportAllSeriesCommand.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Windows;
  6. using System.Windows.Input;
  7. using Aitex.UI.Charting.View;
  8. namespace Aitex.UI.Charting.Command
  9. {
  10. class ExportAllSeriesCommand : ICommand
  11. {
  12. public ExportAllSeriesCommand()
  13. {
  14. }
  15. public bool CanExecute(object parameter)
  16. {
  17. return true;
  18. }
  19. #pragma warning disable 0067
  20. public event EventHandler CanExecuteChanged;
  21. #pragma warning restore 0067
  22. public void Execute(object parameter)
  23. {
  24. string seriesId = Guid.NewGuid().ToString();
  25. Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
  26. dlg.FileName = seriesId.Replace("/", "_").Replace(":", "_").Replace(" ", "_"); // Default file name
  27. dlg.DefaultExt = ".csv"; // Default file extension
  28. dlg.Filter = "Excel (.csv)|*.csv"; // Filter files by extension
  29. // Show open file dialog box
  30. Nullable<bool> result = dlg.ShowDialog();
  31. if (result.HasValue && result.Value)
  32. {
  33. DataSeriesExportingAll processDialog = new DataSeriesExportingAll(dlg.FileName) { Owner = Application.Current.MainWindow };
  34. processDialog.Show();
  35. }
  36. }
  37. }
  38. }