Exemplo n.º 1
0
        private async void ApplyEffectAsync()
        {
            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                progressBar.Visibility    = Visibility.Visible;
                saveImageButton.IsEnabled = false;
            });

            if (_isProcessing)
            {
                _actionQueue.Execute(() => ApplyEffectAsync());
            }
            else
            {
                await Task.Factory.StartNew(() => ApplyEffectInternalAsync());
            }

            await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                progressBar.Visibility = Visibility.Collapsed;

                if (_processedPhotoAsWriteableBitmap != null)
                {
                    saveImageButton.IsEnabled = true;
                }
            });
        }
Exemplo n.º 2
0
        private void OnSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e)
        {
            double newThreshold = e.NewValue;

            if (_videoEngine != null && _videoEngine.EffectSet)
            {
                _actionQueue.Execute(async() =>
                {
                    await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
                    {
                        _videoEngine.SetThreshold((float)newThreshold);
                    });
                }
                                     );
            }

            _settings.Threshold = newThreshold;
            effectSettingsControl.SetSliderText("Threshold: " + newThreshold);
        }