void m_worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { if (m_disposeRequested) { Dispose(); return; } if (e.Error == null) { if (e.Result is VCServerPathRootViewModel) { VCServerPathRootViewModel rootNode = e.Result as VCServerPathRootViewModel; RootList.Add(rootNode); } else if (e.Result is VCServerPathNodeViewModel) { VCServerPathNodeViewModel node = e.Result as VCServerPathNodeViewModel; node.PopulateChildren(); if (m_queue.Count > 0) { QueueLoadChildren(m_queue.Dequeue()); } } } IsLoading = false; }
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; } }