Пример #1
0
        //------------------------------------------------------------------------------------
        /// <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);
                    }
                }
            }
        }
Пример #2
0
        //------------------------------------------------------------------------------------
        /// <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);
            }
        }
Пример #4
0
        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
                };
            }
        }
Пример #5
0
 void logProductLaunchTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result)
 {
 }
Пример #6
0
 //------------------------------------------------------------------------------------
 /// <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));
 }
Пример #7
0
 void CommitTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result)
 {
     HandleCommitComplete(result);
 }
Пример #8
0
 //------------------------------------------------------------------------------------
 /// <summary>
 /// Completion handler for EnsureHostProductTree.
 /// </summary>
 //------------------------------------------------------------------------------------
 void buildTreeTask_TaskCompleted(object TaskArgs, BackgroundTaskResult result)
 {
     IsEnsureHostProductTreeInProgress = false;
 }
Пример #9
0
 public StoreCommitCompleteEventArgs(CommitType commitType, BackgroundTaskResult result)
 {
     CommitType = commitType;
     Result     = result;
 }
Пример #10
0
 public ProductGroupOpenedEvent(string productGroupKey, ProductGroupItem productGroupItem, BackgroundTaskResult result)
 {
     ProductGroupKey  = productGroupKey;
     ProductGroupItem = productGroupItem;
     Result           = result;
 }
 public PlannerQueryCompletedEventArgs(BackgroundTaskResult result, ShouldRefresh shouldRefresh)
 {
     Result        = result;
     ShouldRefresh = shouldRefresh;
 }