internal void ExportClick() { var serializers = ExportSerializers ?? new List <IFileSerializer <List <HistoryEntry> > > { new HistoryEntryCsvSerializer() }; var saveFileDialogView = _viewFactory.GetSaveFileDialogView(); saveFileDialogView.Filter = serializers.GetFileTypeFilters(); if (saveFileDialogView.ShowDialog() == DialogResult.OK) { try { var serializer = serializers[saveFileDialogView.FilterIndex - 1]; serializer.Serialize(saveFileDialogView.FileName, _model.FetchSelectedQuery().ToList()); } catch (Exception ex) { Logger.ErrorFormat(ex, "{0}", ex.Message); _messageBoxView.ShowError(_view, String.Format(CultureInfo.CurrentCulture, "The history data export failed.{0}{0}{1}", Environment.NewLine, ex.Message), Core.Application.NameAndVersion); } } _viewFactory.Release(saveFileDialogView); }
public void FileSaveAsClick() { if (_clientConfiguration.Count == 0) { return; } var saveFileDialogView = _viewFactory.GetSaveFileDialogView(); saveFileDialogView.DefaultExt = _settingsManager.FileExtension; saveFileDialogView.Filter = _settingsManager.FileTypeFilters; if (saveFileDialogView.ShowDialog() == DialogResult.OK) { try { // Issue 75 _settingsManager.Write(_clientConfiguration.GetClients().Select(x => x.Settings), saveFileDialogView.FileName, saveFileDialogView.FilterIndex); _clientConfiguration.IsDirty = false; } catch (Exception ex) { Logger.ErrorFormat(ex, "{0}", ex.Message); _messageBoxView.ShowError(_view, String.Format(CultureInfo.CurrentCulture, "The client configuration has not been saved.{0}{0}{1}", Environment.NewLine, ex.Message), _view.Text); } } _viewFactory.Release(saveFileDialogView); }