示例#1
0
        void OnCheckForUpdatesCompleted(ITask <CheckForUpdatesTask> task)
        {
            if (task.IsFaulted)
            {
                if (IsCurrentTask(task))
                {
                    ReportError(task.Exception);
                }
                else
                {
                    LoggingService.LogInternalError("Check for updates task error.", task.Exception);
                }
            }
            else if (task.IsCancelled)
            {
                // Ignore.
                return;
            }
            else if (!IsCurrentTask(task.Result))
            {
                task.Result.Dispose();
                return;
            }
            else
            {
                task.Result.CheckForUpdatesCompleted();
                GuiBackgroundDispatch(() => {
                    task.Result.Dispose();
                });
            }

            currentCheckForUpdatesTask = null;
            this.task = null;
        }
		public void Start (CheckForUpdatesTask checkForUpdatesTask)
		{
			Stop ();

			CreateCheckForUpdatesTask (checkForUpdatesTask);

			task.Start ();
		}
示例#3
0
        public void Start(CheckForUpdatesTask checkForUpdatesTask)
        {
            Stop();

            CreateCheckForUpdatesTask(checkForUpdatesTask);

            task.Start();
        }
        void CreateCheckForUpdatesTask(CheckForUpdatesTask checkForUpdatesTask)
        {
            currentCheckForUpdatesTask = checkForUpdatesTask;

            task = taskFactory.CreateTask(
                () => CheckForUpdates(checkForUpdatesTask),
                OnCheckForUpdatesCompleted);
        }
		void CreateCheckForUpdatesTask (CheckForUpdatesTask checkForUpdatesTask)
		{
			currentCheckForUpdatesTask = checkForUpdatesTask;

			task = taskFactory.CreateTask (
				() => CheckForUpdates (checkForUpdatesTask),
				OnCheckForUpdatesCompleted);
		}
示例#6
0
 public void CheckForUpdates()
 {
     GuiDispatch(() => {
         Clear();
         var task = new CheckForUpdatesTask(this, GetProjectsWithPackages());
         taskRunner.Start(task);
     });
 }
		void CreateCheckForUpdatesTask (CheckForUpdatesTask checkForUpdatesTask)
		{
			currentCheckForUpdatesTask = checkForUpdatesTask;
			checkForUpdatesTask.ProgressMonitor = CreateProgressMonitor ();

			task = taskFactory.CreateTask (
				() => CheckForUpdates (checkForUpdatesTask),
				OnCheckForUpdatesCompleted);
		}
示例#8
0
        void ReportError(Exception ex)
        {
            CheckForUpdatesTask task = currentCheckForUpdatesTask;

            task.ReportError(ex);
            GuiBackgroundDispatch(() => {
                task.Dispose();
            });
        }
示例#9
0
        void CreateCheckForUpdatesTask(CheckForUpdatesTask checkForUpdatesTask)
        {
            currentCheckForUpdatesTask          = checkForUpdatesTask;
            checkForUpdatesTask.ProgressMonitor = CreateProgressMonitor();

            task = taskFactory.CreateTask(
                () => CheckForUpdates(checkForUpdatesTask),
                OnCheckForUpdatesCompleted);
        }
示例#10
0
        public void CheckForUpdatesCompleted(CheckForUpdatesTask task)
        {
            projectsWithUpdatedPackages = task.ProjectsWithUpdatedPackages.ToList();

            RemovePackagesUpdatedDuringCheckForUpdates();

            if (AnyUpdates())
            {
                packageManagementEvents.OnUpdatedPackagesAvailable();
            }
        }
		public void Stop ()
		{
			if (task != null) {
				task.Cancel ();
				task = null;
			}
			if (currentCheckForUpdatesTask != null) {
				currentCheckForUpdatesTask.Dispose ();
				currentCheckForUpdatesTask = null;
			}
		}
 public void Stop()
 {
     if (task != null) {
         task.Cancel ();
         task = null;
     }
     if (currentCheckForUpdatesTask != null) {
         currentCheckForUpdatesTask.Dispose ();
         currentCheckForUpdatesTask = null;
     }
 }
		bool IsCurrentTask (CheckForUpdatesTask task)
		{
			return currentCheckForUpdatesTask == task;
		}
		CheckForUpdatesTask CheckForUpdates (CheckForUpdatesTask currentTask)
		{
			currentTask.CheckForUpdates ();
			return currentTask;
		}
示例#15
0
 bool IsCurrentTask(CheckForUpdatesTask task)
 {
     return(currentCheckForUpdatesTask == task);
 }
		void OnCheckForUpdatesCompleted (ITask<CheckForUpdatesTask> task)
		{
			if (task.IsFaulted) {
				if (IsCurrentTask (task)) {
					ReportError (task.Exception);
				} else {
					LoggingService.LogInternalError ("Check for updates task error.", task.Exception);
				}
			} else if (task.IsCancelled) {
				// Ignore.
				return;
			} else if (!IsCurrentTask (task.Result)) {
				task.Result.Dispose ();
				return;
			} else {
				task.Result.CheckForUpdatesCompleted ();
				GuiBackgroundDispatch (() => {
					task.Result.Dispose ();
				});
			}

			currentCheckForUpdatesTask = null;
			this.task = null;
		}
示例#17
0
 CheckForUpdatesTask CheckForUpdates(CheckForUpdatesTask currentTask)
 {
     currentTask.CheckForUpdates();
     return(currentTask);
 }