Пример #1
0
        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 => { }));
        }
Пример #2
0
 private void RefreshSelectedApplication(Application application)
 {
     SelectedApplication.PropertyChanged           -= SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Merge(application);
     SelectedApplication.PropertyChanged           += SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged += SelectedApplicationPropertyChanged;
 }
Пример #3
0
 private void RefreshSelectedApplication(Application application)
 {
     SelectedApplication.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged -= SelectedApplicationPropertyChanged;
     SelectedApplication.Merge(application);
     SelectedApplication.PropertyChanged += SelectedApplicationPropertyChanged;
     SelectedApplication.Resources.PropertyChanged += SelectedApplicationPropertyChanged;
 }