public TabItem1ViewModel(IDialogService _dialogService, MainWindowViewModel _parent) : base(_parent) { this._dialogService = _dialogService; SearchCommand = new RelayCommand(SearchCommandHandler); LoadedCommand = new RelayCommand(LoadedCommandHandler); _tabItem1Model = new TabItem1Model(); //TODO avoid calling this in the contructor! It's an ugly Practice //ShowDialog(viewModel => _dialogService.ShowDialog<TabItem1FilterView>(ViewModelLocator.Instance.MainWindowViewModel, viewModel)); }
private void ShowDialog(Func <TabItem1FilterViewModel, bool?> showDialog) { if (_filterModel == null) { _filterModel = new TabItem1FilterModel(); } bool?success = showDialog(new TabItem1FilterViewModel(_filterModel)); if (success == true) { TabItem1Model tabItem1Model = new TabItem1Model(); tabItem1Model.Parameter1 = _filterModel.Parameter1; tabItem1Model.Parameter2 = _filterModel.Parameter2; TabItem1Model = tabItem1Model; } else { Back(); } }