private async void EffectSelection_SelectionChanged(object sender, SelectionChangedEventArgs e) { PointerEffectTechniques.EffectTechniques newTechnique = null; ComboBoxItem item = EffectSelection.SelectedValue as ComboBoxItem; switch ((PointerEffectTechniques.EffectTechniques.EffectTypes)item.Tag) { case PointerEffectTechniques.EffectTechniques.EffectTypes.Exposure: newTechnique = new PointerEffectTechniques.ExposureTechnique(_compositor); break; case PointerEffectTechniques.EffectTechniques.EffectTypes.Desaturation: newTechnique = new PointerEffectTechniques.DesaturateTechnique(_compositor); break; case PointerEffectTechniques.EffectTechniques.EffectTypes.Blur: newTechnique = new PointerEffectTechniques.BlurTechnique(_compositor); break; case PointerEffectTechniques.EffectTechniques.EffectTypes.SpotLight: newTechnique = new PointerEffectTechniques.SpotLightTechnique(_compositor); break; case PointerEffectTechniques.EffectTechniques.EffectTypes.PointLightFollow: newTechnique = new PointerEffectTechniques.PointLightFollowTechnique(_compositor); break; default: break; } // Load the resources async await newTechnique.LoadResources(); // Everything is ready to go, release the current technique if (_currentTechnique != null) { _currentTechnique.ReleaseResources(); _currentTechnique = null; } // Set the new technique _currentTechnique = newTechnique; // Update the list to use the new technique RefreshListViewContent(); }