void HideBusyIndicator() { if (InvokeRequired) { BeginInvoke(new AnkhAction(HideBusyIndicator)); return; } if (_busyOverlay != null) { _busyOverlay.Hide(); } }
void OnFill(Uri uri) { if (uri == null) { throw new ArgumentNullException(); } try { using (SvnPoolRemoteSession session = GetSession(uri)) { string path = session.MakeRelativePath(uri); SvnRemoteListArgs la = new SvnRemoteListArgs(); la.ThrowOnError = false; la.RetrieveEntries = SvnDirEntryItems.Kind; Uri repositoryRoot = null; List <ListViewItem> items = new List <ListViewItem>(); SvnRemoteNodeKindArgs commonArgs = new SvnRemoteNodeKindArgs(); commonArgs.ThrowOnError = false; SvnNodeKind kind; session.GetNodeKind(path, commonArgs, out kind); session.GetRepositoryRoot(out repositoryRoot); bool ok = (kind == SvnNodeKind.File) || session.List(path, la, delegate(object sender, SvnRemoteListEventArgs e) { if (string.IsNullOrEmpty(e.Path)) { return; } ListViewItem lvi = new ListViewItem(); lvi.Tag = e.Uri; lvi.Text = SvnTools.GetFileName(e.Uri); lvi.ImageIndex = (e.Entry.NodeKind == SvnNodeKind.Directory) ? _dirOffset : _fileOffset; items.Add(lvi); }); if (IsHandleCreated) { Invoke((AnkhAction) delegate() { if (uri == _currentUri) { dirView.Items.Clear(); if (repositoryRoot != null && !_repositoryRoots.Contains(repositoryRoot)) { _repositoryRoots.Add(repositoryRoot); } if (ok) { IFileIconMapper mapper = Context != null ? Context.GetService <IFileIconMapper>() : null; foreach (ListViewItem item in items) { if (item.ImageIndex == _fileOffset) { string ext = Path.GetExtension(item.Text); if (!string.IsNullOrEmpty(ext)) { int n = mapper.GetIconForExtension(ext); if (n > 0) { item.ImageIndex = n; } } } } SetView(items.ToArray()); _walking[uri] = items; } else { string message = string.Format("<{0}>", la.LastException != null ? la.LastException.Message : "Nothing"); dirView.Items.Add(message); } } }); } } } catch (SvnException svnEx) { BeginInvoke((AnkhAction) delegate() { dirView.Items.Clear(); string message = string.Format("<{0}>", svnEx.Message); dirView.Items.Add(message); }); } finally { BeginInvoke((AnkhAction) delegate() { lock (_running) { _running.Remove(uri); if (_running.Count == 0) { if (_busy != null && _loading) { _loading = false; _busy.Hide(); } } } }); // Exception or something } }