private async Task ConnectToInfoBase(object parameter) { TreeNodeViewModel treeNode = parameter as TreeNodeViewModel; if (treeNode == null) { return; } Server server = treeNode.NodePayload as Server; if (server == null) { return; } IMetadataReader metadataReader = _shell.GetService <IMetadataReader>(); List <Database> databases = metadataReader.GetDatabases(server); if (databases.Count == 0) { return; } SelectInfoBaseDialog dialog = new SelectInfoBaseDialog(databases); _ = dialog.ShowDialog(); if (dialog.Result == null) { return; } string databaseName = ((Database)dialog.Result).Name; Database database = (Database)server.Domains.Where(i => i.Name == databaseName).FirstOrDefault(); if (database != null) { return; } database = new Database() { Name = databaseName, Owner = server }; server.Domains.Add(database); await DoWorkAsync(database); IController controller = GetController <DatabaseController>(); controller.BuildTreeNode(database, out TreeNodeViewModel childNode); treeNode.TreeNodes.Add(childNode); //Persist(database); }