static void ExportScreenshot() { ScreenshotExporterViewModel vm = new ScreenshotExporterViewModel(); if (vm.ExportSelectionCommand.CanExecute(null)) { vm.ChooseFileNameMessage.Sent += (sender, args) => { try { Logger.Info("Choose file name message was received"); ChooseFileSaveAction a = new ChooseFileSaveAction(); a.Invoke(args); } catch (Excel.CopyException) { NotificationAction a = new NotificationAction(); a.Caption = Strings.ScreenshotExport; a.Message = Strings.GraphicHasNoCopyMethod; a.Invoke(); } }; vm.ExportSelectionCommand.Execute(null); } else { NotificationAction a = new NotificationAction(); a.Caption = Strings.ScreenshotExport; a.Message = Strings.ScreenshotExportRequiresGraphic; a.Invoke(); } }
static void SaveCsv(Xl.Range range) { Csv.CsvExportViewModel vm = CreateCsvExportViewModel(range); vm.ChooseExportFileNameMessage.Sent += (sender, args) => { ChooseFileSaveAction a = new ChooseFileSaveAction(); a.Invoke(args); }; vm.ChooseFileNameCommand.Execute(null); }
void ChooseFileNameMessage_Sent(object sender, MessageArgs <FileNameMessageContent> e) { ChooseFileSaveAction action = new ChooseFileSaveAction(); action.Invoke(e); }