public void DeleteApplication()
        {
            var worker = new BackgroundWorker {
                WorkerReportsProgress = true
            };

            SetProgressTitle("Delete Application");
            worker.ProgressChanged += WorkerProgressChanged;
            worker.DoWork          += (s, e) =>
            {
                worker.ReportProgress(30, "Deleting Application: " + SelectedApplication.Name);
                ProviderResponse <bool> appResult = provider.Delete(SelectedApplication.DeepCopy(), Cloud.DeepCopy());
                if (!appResult.Response)
                {
                    worker.ReportProgress(-1, appResult.Message);
                    return;
                }
                e.Result = appResult.Response;
            };
            worker.RunWorkerCompleted += (s, e) =>
            {
                Application applicationToRemove =
                    Cloud.Applications.SingleOrDefault((i) => i.Name == SelectedApplication.Name);
                if (applicationToRemove != null)
                {
                    int index = Cloud.Applications.IndexOf(applicationToRemove);
                    Cloud.Applications.RemoveAt(index);
                }
                Messenger.Default.Send(new ProgressMessage(100, "Application Deleted."));
            };
            worker.RunWorkerAsync();
            Messenger.Default.Send(new NotificationMessageAction <bool>(Messages.Progress, c => { }));
        }
 private void RefreshSelectedApplication(Application application)
 {
     SelectedApplication.PropertyChanged           -= SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Merge(application);
     SelectedApplication.PropertyChanged           += SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged += SelectedApplicationPropertyChanged;
 }
 private void RefreshSelectedApplication(Application application)
 {
     SelectedApplication.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Merge(application);
     SelectedApplication.PropertyChanged += SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged += SelectedApplicationPropertyChanged;
 }