public void Dispose() { VisualGitAction runner = _runner; _runner = null; runner(); }
/// <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(VisualGitAction task) { if (task == null) return; lock (_todo) { _todo.Add(task); try { if (!_queued && IsHandleCreated) { BeginInvoke(new VisualGitAction(RunQueue)); _queued = true; } } catch { // Don't kill svn on a failed begin invoke } } }
public DelegateRunner(VisualGitAction runner) { if (runner == null) throw new ArgumentNullException("runner"); _runner = runner; }
public int Schedule(TimeSpan timeSpan, VisualGitAction action) { return ScheduleAt(DateTime.Now + timeSpan, action); }
public ActionItem(int id, VisualGitAction action) { Id = id; Action = action; }
public int ScheduleAt(DateTime time, VisualGitAction 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 PostIdleAction(VisualGitAction action) { if (action == null) throw new ArgumentNullException("action"); lock (_idleActions) { _idleActions.Enqueue(action); } }