using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Input; using Aitex.UI.Charting.View; namespace Aitex.UI.Charting.Command { class ExportAllSeriesCommand : ICommand { public ExportAllSeriesCommand() { } public bool CanExecute(object parameter) { return true; } #pragma warning disable 0067 public event EventHandler CanExecuteChanged; #pragma warning restore 0067 public void Execute(object parameter) { string seriesId = Guid.NewGuid().ToString(); Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog(); dlg.FileName = seriesId.Replace("/", "_").Replace(":", "_").Replace(" ", "_"); // Default file name dlg.DefaultExt = ".csv"; // Default file extension dlg.Filter = "Excel (.csv)|*.csv"; // Filter files by extension // Show open file dialog box Nullable result = dlg.ShowDialog(); if (result.HasValue && result.Value) { DataSeriesExportingAll processDialog = new DataSeriesExportingAll(dlg.FileName) { Owner = Application.Current.MainWindow }; processDialog.Show(); } } } }