private static void FindRoot(IAnkhServiceProvider context, Uri selectedUri, CheckoutProject dlg) { AnkhAction ds = delegate { using (SvnClient client = context.GetService <ISvnClientPool>().GetClient()) { string value; if (client.TryGetProperty(selectedUri, AnkhSccPropertyNames.ProjectRoot, out value)) { if (dlg.IsHandleCreated) { dlg.Invoke((AnkhAction) delegate { try { dlg.ProjectTop = new Uri(selectedUri, value); } catch { }; }); } } } }; ds.BeginInvoke(null, null); }
public int ScheduleAt(DateTime time, AnkhAction action) { if (action == null) { throw new ArgumentNullException("action"); } if (time.Kind == DateTimeKind.Utc) { time = time.ToLocalTime(); } lock (_actions) { while (_actions.ContainsKey(time)) { time = time.Add(TimeSpan.FromMilliseconds(1)); } ActionItem ai = new ActionItem(unchecked (++_nextActionId), action); _actions.Add(time, ai); Reschedule(); return(ai.Id); } }
public void Dispose() { AnkhAction runner = _runner; _runner = null; runner(); }
void ShowAddUriDialog() { Uri dirUri; /* * using (AddRepositoryRootDialog dlg = new AddRepositoryRootDialog()) * { * if (dlg.ShowDialog(Context) != DialogResult.OK || dlg.Uri == null) * return; * * dirUri = dlg.Uri; * } */ using (RepositorySelectionWizard dialog = new RepositorySelectionWizard(Context)) { DialogResult result = dialog.ShowDialog(Context); if (result != DialogResult.OK) { return; } dirUri = dialog.GetSelectedRepositoryUri(); } AnkhAction action = delegate { CheckResult(dirUri, true); }; action.BeginInvoke(null, null); }
/// <summary> /// Enqueus a task for processing in the UI thread. All tasks will run in the same order as in which they are enqueued /// </summary> /// <param name="task"></param> void Enqueue(AnkhAction task) { if (task == null) { return; } lock (_todo) { _todo.Add(task); try { if (!_queued && IsHandleCreated) { BeginInvoke(new AnkhAction(RunQueue)); _queued = true; } } catch { // Don't kill svn on a failed begin invoke } } }
void ProcessOk() { UpdateDirectories(); string fileText = fileNameBox.Text; if (string.IsNullOrEmpty(fileText)) { return; } Uri dirUri; Uri fileUri; if (Uri.TryCreate(urlBox.Text, UriKind.Absolute, out dirUri) && Uri.TryCreate(fileText, UriKind.Relative, out fileUri)) { Uri combined = SvnTools.AppendPathSuffix(dirUri, SvnTools.UriPartToPath(fileText)); AnkhAction fill = delegate() { CheckResult(combined); }; fill.BeginInvoke(null, null); } }
public DelegateRunner(AnkhAction runner) { if (runner == null) { throw new ArgumentNullException("runner"); } _runner = runner; }
void PostCheck() { AnkhAction pt = delegate() { Thread.Sleep(50); SyncContext.Post(TryRelease, null); }; pt.BeginInvoke(null, null); }
void PostCheck() { ThreadHelper.ThrowIfNotOnUIThread(); AnkhAction pt = delegate() { Thread.Sleep(50); SyncContext.Post(TryRelease, null); }; pt.BeginInvoke(null, null); }
public void PostIdleAction(AnkhAction action) { if (action == null) { throw new ArgumentNullException("action"); } lock (_idleActions) { _idleActions.Enqueue(action); } }
private void RefreshBox(Uri uri) { _currentUri = uri; dirView.Items.Clear(); if (_walking.ContainsKey(uri)) { List <ListViewItem> items = _walking[uri]; if (items != null) { SetView(items.ToArray()); } else { dirView.Items.Add("<loading>"); } } else { dirView.Items.Add("<loading>"); } lock (_running) { if (_running.ContainsKey(uri)) { return; } _running[uri] = uri; // Mark as walking if (!_loading) { if (_busy == null) { _busy = new BusyOverlay(dirView, AnchorStyles.Right | AnchorStyles.Top); } _loading = true; _busy.Show(); } } AnkhAction fill = delegate() { OnFill(uri); }; fill.BeginInvoke(null, null); }
public void Dispose() { using (_dlg) // Closes dialog if needed { while (_closers.Count > 0) { AnkhAction action = _closers.Pop(); try { action(); } catch { } } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (Context != null) { foreach (string url in Context.GetService <IAnkhConfigurationService>().GetRecentReposUrls()) { this.urlComboBox.Items.Add(url); } } this.urlComboBox.Select(); AnkhAction populateProviders = new AnkhAction(InitializeProviders); BeginInvoke(populateProviders); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); syncView.Context = Context; syncView.ColumnWidthChanged += new ColumnWidthChangedEventHandler(syncView_ColumnWidthChanged); IDictionary <string, int> widths = ConfigurationService.GetColumnWidths(GetType()); syncView.SetColumnWidths(widths); _recentChangesAction = new AnkhAction(DoRefresh); // if solution is not open, don't auto-refresh IAnkhCommandStates commandState = Context.GetService <IAnkhCommandStates>(); _solutionExists = (commandState != null && commandState.SolutionExists); RefreshIntervalConfigModified(); HookHandlers(); }
public BatchUpdateDisposer(AnkhAction action) { _action = action; }
internal void BrowseItem(Uri uri) { if (uri == null) { throw new ArgumentNullException("uri"); } if (DesignMode) { return; } Uri nUri = SvnTools.GetNormalizedUri(uri); if (_running.Contains(nUri)) { return; } _running.Add(nUri); if (_running.Count == 1) { OnRetrievingChanged(EventArgs.Empty); } AnkhAction d = delegate() { bool ok = false; try { SvnListArgs la = new SvnListArgs(); la.RetrieveEntries = RetrieveItems; la.RetrieveLocks = RetrieveLocks; la.Depth = SvnDepth.Children; la.ThrowOnError = false; Collection <SvnListEventArgs> items; using (SvnClient client = Context.GetService <ISvnClientPool>().GetClient()) { client.GetList(uri, la, out items); } AnkhAction addItems = (AnkhAction) delegate() { if (items != null && items.Count > 0) { bool first = true; foreach (SvnListEventArgs a in items) { if (first) { if (a.RepositoryRoot != null) { EnsureRoot(a.RepositoryRoot); } } AddItem(a, a.RepositoryRoot); first = false; } MaybeExpand(uri); } _running.Remove(nUri); if (_running.Count == 0) { OnRetrievingChanged(EventArgs.Empty); } }; if (IsHandleCreated) { BeginInvoke(addItems); } else { addItems(); } ok = true; } finally { if (!ok) { BeginInvoke((AnkhAction) delegate() { _running.Remove(nUri); if (_running.Count == 0) { OnRetrievingChanged(EventArgs.Empty); } }); } } }; d.BeginInvoke(null, null); }
public int Schedule(TimeSpan timeSpan, AnkhAction action) { return ScheduleAt(DateTime.Now + timeSpan, action); }
/// <summary> /// Enqueus a task for processing in the UI thread. All tasks will run in the same order as in which they are enqueued /// </summary> /// <param name="task"></param> void Enqueue(AnkhAction task) { if (task == null) return; lock (_todo) { _todo.Add(task); try { if (!_queued && IsHandleCreated) { BeginInvoke(new AnkhAction(RunQueue)); _queued = true; } } catch { // Don't kill svn on a failed begin invoke } } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); syncView.Context = Context; syncView.ColumnWidthChanged += new ColumnWidthChangedEventHandler(syncView_ColumnWidthChanged); IDictionary<string, int> widths = ConfigurationService.GetColumnWidths(GetType()); syncView.SetColumnWidths(widths); _recentChangesAction = new AnkhAction(DoRefresh); // if solution is not open, don't auto-refresh IAnkhCommandStates commandState = Context.GetService<IAnkhCommandStates>(); _solutionExists = (commandState != null && commandState.SolutionExists); RefreshIntervalConfigModified(); HookHandlers(); }
public IDisposable BatchUpdate(AnkhAction doneHandler) { return(new BatchUpdateDisposer(doneHandler)); }
public int Schedule(TimeSpan timeSpan, AnkhAction action) { return(ScheduleAt(DateTime.Now + timeSpan, action)); }
public ActionItem(int id, AnkhAction action) { Id = id; Action = action; }
public void PostIdleAction(AnkhAction action) { if (action == null) throw new ArgumentNullException("action"); lock (_idleActions) { _idleActions.Enqueue(action); } }
public int ScheduleAt(DateTime time, AnkhAction action) { if (action == null) throw new ArgumentNullException("action"); if (time.Kind == DateTimeKind.Utc) time = time.ToLocalTime(); lock (_actions) { while (_actions.ContainsKey(time)) time = time.Add(TimeSpan.FromMilliseconds(1)); ActionItem ai = new ActionItem(unchecked(++_nextActionId), action); _actions.Add(time, ai); Reschedule(); return ai.Id; } }