void m_worker_DoWork(object sender, DoWorkEventArgs e) { if (e.Argument is VCServerPathNodeViewModel) { VCServerPathNodeViewModel node = e.Argument as VCServerPathNodeViewModel; node.GetItems(m_repository); e.Result = node; } else { string userName = null; string password = null; foreach (CustomSetting setting in m_migrationSource.CustomSettings.CustomSetting) { if (setting.SettingKey.Equals("UserName")) { userName = setting.SettingValue; } else if (setting.SettingKey.Equals("Password")) { password = setting.SettingValue; } } m_repository = Repository.GetRepository(new Uri(m_migrationSource.ServerUrl), userName, password); m_latestRevision = m_repository.GetLatestRevisionNumber(); Item item = m_repository.GetItems(new Uri(m_migrationSource.ServerUrl), m_latestRevision, Depth.Empty).First(); VCServerPathRootViewModel rootNode = new VCServerPathRootViewModel(item, m_latestRevision, this); rootNode.Load(m_repository); rootNode.IsExpanded = true; SelectedNode = rootNode; string[] tokens = m_filterItem.FilterString.Split(PathUtils.Separator); for (int i = 2; i < tokens.Length; i++) { SelectedNode.Load(m_repository); SelectedNode.IsExpanded = true; VCServerPathNodeViewModel newSelectedNode = SelectedNode.Children.FirstOrDefault(x => string.Equals(x.DisplayName, tokens[i])); if (newSelectedNode != null) { SelectedNode = newSelectedNode; } else { break; } } e.Result = rootNode; } }
void m_worker_DoWork(object sender, DoWorkEventArgs e) { if (e.Argument is VCServerPathNodeViewModel) { VCServerPathNodeViewModel node = e.Argument as VCServerPathNodeViewModel; node.GetItems(m_server); e.Result = node; } else { TeamFoundationServer collection = TeamFoundationServerFactory.GetServer(m_migrationSource.ServerUrl); m_server = collection.GetService(typeof(VersionControlServer)) as VersionControlServer; Item item = m_server.GetItem(VersionControlPath.RootFolder + m_migrationSource.SourceIdentifier); VCServerPathRootViewModel rootNode = new VCServerPathRootViewModel(item, this); rootNode.Load(m_server); rootNode.IsExpanded = true; SelectedNode = rootNode; string[] tokens = m_filterItem.FilterString.Split(VersionControlPath.Separator); for (int i = 2; i < tokens.Length; i++) { SelectedNode.Load(m_server); SelectedNode.IsExpanded = true; VCServerPathNodeViewModel newSelectedNode = SelectedNode.Children.FirstOrDefault(x => string.Equals(x.DisplayName, tokens[i])); if (newSelectedNode != null) { SelectedNode = newSelectedNode; } else { break; } } e.Result = rootNode; } }