main
1using System.Windows.Forms;
2using Gorilla.Commons.Infrastructure.FileSystem;
3using momoney.presentation.views;
4
5namespace MoMoney.Presentation.Winforms.Views
6{
7 public class SelectFileToOpenDialog : ISelectFileToOpenDialog
8 {
9 readonly IWin32Window window;
10 readonly FileDialog dialog;
11
12 public SelectFileToOpenDialog(IWin32Window window)
13 {
14 this.window = window;
15 dialog = new OpenFileDialog {Filter = "My Money Files (*.mo)|*.mo"};
16 }
17
18 public File tell_me_the_path_to_the_file()
19 {
20 var result = dialog.ShowDialog(window);
21 var path_to_the_file =
22 (ApplicationFile) (result.Equals(DialogResult.Cancel) ? string.Empty : dialog.FileName);
23 dialog.Dispose();
24 return path_to_the_file;
25 }
26 }
27}