/// <summary> /// Initializes categories in the background. /// </summary> /// <param name="continuationTaskScheduler">The task scheduler that should be used for the continuation. /// This should usually be the scheduler of the UI thread.</param> private void InitializeCategoriesAsync(TaskScheduler continuationTaskScheduler) { IsAdornerVisible = true; Entities.Categories categories = null; var task = new Task(() => { categories = _categoryRepository.GetCategories(); }); task.ContinueWith( x => { _seriesSelectionVM = _dependencyComposer.GetExportedValue <ISeriesSelectionVM>(); _seriesSelectionVM.Initialize(categories.Series, TextFilter); _showSelectionVM = _dependencyComposer.GetExportedValue <IShowSelectionVM>(); _showSelectionVM.Initialize(categories.Shows, TextFilter); _tagSelectionVM = _dependencyComposer.GetExportedValue <ITagSelectionVM>(); _tagSelectionVM.Initialize(categories.Tags, TextFilter); CurrentContent = _tagSelectionVM; IsAdornerVisible = false; CommandManager.InvalidateRequerySuggested(); }, continuationTaskScheduler); task.Start(); }
/// <summary> /// Initializes categories in the background. /// </summary> /// <param name="continuationTaskScheduler">The task scheduler that should be used for the continuation. /// This should usually be the scheduler of the UI thread.</param> private void InitializeCategoriesAsync(TaskScheduler continuationTaskScheduler) { IsAdornerVisible = true; Entities.Categories categories = null; var task = new Task(() => { categories = _categoryRepository.GetCategories(); }); task.ContinueWith( x => { _seriesSelectionVM = _dependencyComposer.GetExportedValue<ISeriesSelectionVM>(); _seriesSelectionVM.Initialize(categories.Series, TextFilter); _showSelectionVM = _dependencyComposer.GetExportedValue<IShowSelectionVM>(); _showSelectionVM.Initialize(categories.Shows, TextFilter); _tagSelectionVM = _dependencyComposer.GetExportedValue<ITagSelectionVM>(); _tagSelectionVM.Initialize(categories.Tags, TextFilter); CurrentContent = _tagSelectionVM; IsAdornerVisible = false; CommandManager.InvalidateRequerySuggested(); }, continuationTaskScheduler); task.Start(); }