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 FileOpenClick() { if (CheckForConfigurationChanges()) { var openFileDialogView = _viewFactory.GetOpenFileDialogView(); openFileDialogView.DefaultExt = _settingsManager.FileExtension; openFileDialogView.Filter = _settingsManager.FileTypeFilters; openFileDialogView.FileName = _settingsManager.FileName; openFileDialogView.RestoreDirectory = true; if (openFileDialogView.ShowDialog() == DialogResult.OK) { ClearConfiguration(); LoadConfigFile(openFileDialogView.FileName, openFileDialogView.FilterIndex); } _viewFactory.Release(openFileDialogView); } }