public MainWindowViewModel(string repositotyFileName) { _repositoryFileName = repositotyFileName; _repositoryViewModel = new RepositoryViewModel(_repositoryFileName); _repositoryViewModel.FuncSqlViewModelSelected += _repositoryViewModel_RequestSelected; base.DisplayName = "Тестирование сервиса jqsbyt"; Tabs.Add(new SearchViewModel()); Tabs.Add(new ShemaUchetViewModel()); Tabs.Add(new ManualRequestViewModel() { DisplayName = "Ручной запрос" }); SelectedItem = Tabs[0]; CreateNewManualRequestTabCommand = new DelegateCommand(() => { var list = Tabs.Where((t) => (t is ManualRequestViewModel) && (t.DisplayName.StartsWith("Запрос данных"))).ToList(); ManualRequestViewModel mrvm = new ManualRequestViewModel(); if (list != null) { mrvm.DisplayName += " (" + (list.Count + 1) + ")"; } Tabs.Add(mrvm); }); }
private void _repositoryViewModel_RequestSelected(object sender, SelectFuncSqlViewModelEventArgs e) { ManualRequestViewModel mrvm = new ManualRequestViewModel(e.ViewModel); mrvm.DisplayName = e.Name; // скрытие панели выбора функции сервиса - уже выбрана функция sql mrvm.IsServiceFunctionSelectorVisible = false; Tabs.Add(mrvm); SelectedItem = mrvm; }