private void SyncView() { if (CheckAccess()) { if (null != m_view) { lock (m_view.Sync) { foreach (var fts in m_view.FileStatuses) { FileTransferModel ftm = m_transfers.FirstOrDefault((candidate) => 0 == string.Compare(fts.Name, candidate.FileName, StringComparison.InvariantCultureIgnoreCase)); if (null == ftm) { ftm = new FileTransferModel() { FileName = fts.Name }; m_transfers.Add(ftm); } ftm.Reason = fts.StatusType.ToString(); ftm.Size = fts.Size; foreach (var fths in fts.HopStatuses) { NodeModel parentNode = m_nodes.FirstOrDefault((candidate) => 0 == string.Compare(candidate.Id, fths.ParentNodeId.ToString(), StringComparison.InvariantCultureIgnoreCase)); NodeModel childNode = m_nodes.FirstOrDefault((candidate) => 0 == string.Compare(candidate.Id, fths.ChildNodeId.ToString(), StringComparison.InvariantCultureIgnoreCase)); FileTransferHopModel fthm = ftm.Hops.FirstOrDefault((candidate) => candidate.ParentNode == parentNode && candidate.ChildNode == childNode); if (null == fthm) { fthm = new FileTransferHopModel() { ParentNode = parentNode, ChildNode = childNode, Transfer = ftm, }; ftm.Hops.Add(fthm); } fthm.Progress = fths.Progress; fthm.Rate = fths.Rate; } } } } } else { Dispatcher.BeginInvoke(new Action(m_view_StatusChanged), null); } }