Example #1
0
 public void Dispose()
 {
     VisualGitAction runner = _runner;
     _runner = null;
     runner();
 }
Example #2
0
        /// <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
                }
            }
        }
Example #3
0
 public DelegateRunner(VisualGitAction runner)
 {
     if (runner == null)
         throw new ArgumentNullException("runner");
     _runner = runner;
 }
Example #4
0
 public int Schedule(TimeSpan timeSpan, VisualGitAction action)
 {
     return ScheduleAt(DateTime.Now + timeSpan, action);
 }
Example #5
0
 public ActionItem(int id, VisualGitAction action)
 {
     Id = id;
     Action = action;
 }
Example #6
0
        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);
            }
        }