public void Execute(object parameter) { object[] parameters = (object[])parameter; MainWindowViewModel mainViewModel = (MainWindowViewModel)parameters[0]; int type = (int)parameters[1]; string filePath = (type < 2) ? myFilePathProvider.GetOpenFilePath() : myFilePathProvider.GetSaveFilePath(); if (!String.IsNullOrWhiteSpace(filePath)) { switch (type) { case 0: mainViewModel.DailyReportFilePath = filePath; break; case 1: mainViewModel.UnallocatedCashReportFilePath = filePath; break; case 2: mainViewModel.OutputFilePath = filePath; break; default: throw new NotSupportedException(); } } }
private void OnOpen(object sender, EventArgs e) { var filePath = _filePathProvider.GetOpenFilePath(); if (string.IsNullOrEmpty(filePath)) { return; } Open(filePath); }