I am just wondering is this the way to show dialogs in MVVM?
public ICommand OpenFileCommand
{
get
{
if (_openFileCommand == null) {
_openFileCommand = new RelayCommand(delegate
{
var strArr = DialogsViewModel.GetOpenFileDialog("Open a file ...", "Text files|*.txt | All Files|*.*");
foreach (string s in strArr) {
// do something with file
}
});
}
return _openFileCommand;
}
}
public class DialogsViewModel {
public static string[] GetOpenFileDialog(string title, string filter)
{
var dialog = new OpenFileDialog();
dialog.Title = title;
dialog.Filter = filter;
dialog.CheckFileExists = true;
dialog.CheckPathExists = true;
dialog.Multiselect = true;
if ((bool)dialog.ShowDialog()) {
return dialog.SafeFileNames;
}
return new string[0];
}
}
If so how should I allow myself to say modify the options on dialogs I am showing. Example, I want another dialog to have different dialog options dialog.something = something_else
without adding alot of arguments to my method