//------------------------------------------------------------------------------------ /// <summary> /// Will be called when the commit thread completes (or successfully responds to a /// cancellation request). /// </summary> //------------------------------------------------------------------------------------ void BackgroundTask_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { AbortableBackgroundWorker worker = sender as AbortableBackgroundWorker; if (worker.IsAborted) { if (TaskCompleted != null) { TaskCompleted(TaskArgs, new BackgroundTaskResult { Task = this, ResultType = ResultType.Cancelled }); } } else { if (ProgressDialog != null) { ProgressDialog.CancelRequested -= ProgressDialog_CancelRequested; if (ProgressDialogOption != PlannerNameSpace.ProgressDialogOption.StandardProgressNoClose) { ProgressDialog.CloseDialog(); } } if (e.Cancelled) { if (TaskCompleted != null) { TaskCompleted(TaskArgs, new BackgroundTaskResult { Task = this, ResultType = ResultType.Cancelled }); } } else { BackgroundTaskResult result = e.Result as BackgroundTaskResult; if (result != null) { result.Task = this; } if (result != null && result.ResultType == ResultType.Failed) { Planner.Instance.HandleFailedTask(result); } if (TaskCompleted != null) { TaskCompleted(TaskArgs, result); } } } }
//------------------------------------------------------------------------------------ /// <summary> /// Displays an appropriate error message based on the given error result. /// </summary> //------------------------------------------------------------------------------------ public void HandleFailedTask(BackgroundTaskResult result) { StoreErrors error = Datastore.GetStoreErrorFromExceptionMessage(result.ResultMessage); if (error == StoreErrors.ProductStudioNotInstalled || error == StoreErrors.ProductStudioNewerVersionRequired) { //ProductStudioNotInstalledDialog dialog = new ProductStudioNotInstalledDialog(error); //dialog.ShowDialog(); } else { UserMessage.Show(result.ResultMessage); } }
void getImageValueTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result) { ImageArgs imageArgs = TaskArgs as ImageArgs; if (imageArgs.PublicPropName != null) { StoreItem itemToNotify = imageArgs.ItemToNotify; if (itemToNotify == null) { itemToNotify = Item; } itemToNotify.NotifyPropertyChangedByName(imageArgs.PublicPropName); } }
void CommitTask_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { BackgroundTask task = e.Argument as BackgroundTask; if (ChangeList.Count > 0) { int currentItem = 1; int totalItems = ChangeList.Count; foreach (StoreItem item in ChangeList) { if (task.CancellationPending) { e.Cancel = true; e.Result = new BackgroundTaskResult { ResultType = ResultType.Cancelled }; return; } task.ReportProgress((currentItem * 100) / totalItems, item.ID.ToString() + ": " + item.Title, "Change " + currentItem.ToString() + " of " + totalItems.ToString()); BackgroundTaskResult result = CommitItemWorker(item, NewCommittedItems); if (result.ResultType != ResultType.Completed) { e.Result = result; return; } ItemsCommittedSuccessfully.Add(item); currentItem++; } e.Result = new BackgroundTaskResult { ResultType = ResultType.Completed }; } }
void logProductLaunchTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result) { }
//------------------------------------------------------------------------------------ /// <summary> /// Encapsulates all rules for handling the end of a commit operation. /// </summary> //------------------------------------------------------------------------------------ public void HandleCommitComplete(BackgroundTaskResult result) { Planner.OnStoreCommitComplete(this, new StoreCommitCompleteEventArgs(CommitType, result)); }
void CommitTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result) { HandleCommitComplete(result); }
//------------------------------------------------------------------------------------ /// <summary> /// Completion handler for EnsureHostProductTree. /// </summary> //------------------------------------------------------------------------------------ void buildTreeTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result) { IsEnsureHostProductTreeInProgress = false; }
public StoreCommitCompleteEventArgs(CommitType commitType, BackgroundTaskResult result) { CommitType = commitType; Result = result; }
public ProductGroupOpenedEvent(string productGroupKey, ProductGroupItem productGroupItem, BackgroundTaskResult result) { ProductGroupKey = productGroupKey; ProductGroupItem = productGroupItem; Result = result; }
public PlannerQueryCompletedEventArgs(BackgroundTaskResult result, ShouldRefresh shouldRefresh) { Result = result; ShouldRefresh = shouldRefresh; }