private void FileDLDone_PropertyChanged(object sender, PropertyChangedEventArgs e) { if (fileDLDone.IsSuccessfullyCompleted && e.PropertyName == "IsSuccessfullyCompleted") { var tmpList = fileDLDone.Result; tmpList = tmpList.OrderBy(p => p.title).ToList(); jobList = new ObservableCollection <Job>(tmpList); canLoad = true; LoadListCommand.RaiseCanExecuteChanged(); canSave = true; SaveListCommand.RaiseCanExecuteChanged(); } }
private void LoadList() { canLoad = false; LoadListCommand.RaiseCanExecuteChanged(); if (txtChk) { Debug.WriteLine("a txt file must be loaded"); canLoad = true; LoadListCommand.RaiseCanExecuteChanged(); } else if (xmlChk) { jobList = new ObservableCollection <Job>() { new Job() { title = "Sorry, this function is not implemented yet", } }; canLoad = true; LoadListCommand.RaiseCanExecuteChanged(); } else { jl = new List <Job>(); string jobsURL = @""; inputDLer = new JsonJobListDLer(jobsURL); jobListParser = new JsonJobListParser(); status.percent = 0; status.process = "Process started"; status.isBusy = true; isIndeterminate = true; GetJobList getJobs = new GetJobList(); fileDLDone = NotifyTaskCompletion.Create(getJobs.GetJobListAsync(inputDLer, jobListParser)); fileDLDone.PropertyChanged += FileDLDone_PropertyChanged; } }