private void OnBrowseForFileCommandExecute()
{
if (this.showingDialog)
{
return;
}
try
{
this.showingDialog = true;
var dialog = this.userPromptOpenFileFactory();
dialog.DefaultExt = "*.CSV";
dialog.Title = "Select a CSV file of transactions to load.";
dialog.Filter = "Comma Separated Values (*.CSV)|*.CSV";
bool? result = dialog.ShowDialog();
if (result == null || result == false)
{
FileName = null;
return;
}
if (!File.Exists(dialog.FileName))
{
this.messageBox.Show("File not found.\n" + dialog.FileName, "Open file");
FileName = null;
return;
}
FileName = dialog.FileName;
}
finally
{
this.showingDialog = false;
}
}