private async void OnSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e) { var slider = sender as Slider; if (storeditem != null && StoredProperty != null) { if (StoredProperty.isInitialize) { if (slider.Tag?.ToString() != StoredProperty.ParameterName) { return; } if (slider.Value >= StoredProperty.MinValue && slider.Value <= StoredProperty.MaxValue) { StoredProperty.CurrentValue = slider.Value; UpdateStoredAlgorithm(currentOperation, StoredProperty); if (cacheFrame != null) { await ProcessWithOpenCV(cacheFrame); } } } else { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { // initialize slider collection.ItemsSource = Algorithm.GetObjects(storeditem); StoredProperty.isInitialize = true; }); } } }
private async void OnComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e) { if (storeditem != null && StoredProperty != null) { if (StoredProperty.isInitialize) { var combo = sender as ComboBox; var selectIdx = combo.SelectedIndex; if (combo.Tag?.ToString() != StoredProperty.ParameterName) { return; } StoredProperty.CurrentValue = (double)selectIdx; UpdateStoredAlgorithm(currentOperation, StoredProperty); if (cacheFrame != null) { await ProcessWithOpenCV(cacheFrame); } } else { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { // initialize slider collection.ItemsSource = Algorithm.GetObjects(storeditem); StoredProperty.isInitialize = true; }); } } }
private async void OnSliderValueChanged(object sender, RangeBaseValueChangedEventArgs e) { var slider = sender as Slider; await this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (this.storeditem != null && this.StoredProperty != null) { if (slider.Tag.ToString() != this.StoredProperty.ParameterName) { return; } if (this.StoredProperty.isInitialize) { if (slider.Value >= this.StoredProperty.MinValue && slider.Value <= this.StoredProperty.MaxValue) { this.StoredProperty.CurrentValue = slider.Value; this.UpdateStoredAlgorithm(this.currentOperation, this.StoredProperty); } } else { // initialize slider this.collection.ItemsSource = Algorithm.GetObjects(this.storeditem); this.StoredProperty.isInitialize = true; } } }); }
private async void Slider1_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { if (_storeditem != null && _storedProperty != null) { var res = sender as Slider; if (res.Tag.ToString() != _storedProperty.ParameterName) { return; } if (_storedProperty.isInitialize) { _storedProperty.CurrentValue = res.Value; UpdateStoredAlgorithm(currentOperation, _storedProperty); } else { // initialize slider collection.ItemsSource = Algorithm.GetObjects(_storeditem); _storedProperty.isInitialize = true; } } }); }
private async void OnOpComboBoxSelectionChanged(object sender, RoutedEventArgs e) { ComboBox comboBox = sender as ComboBox; // Process ComboBox selection when first loaded or when selection has changed from the current. if (comboBox != null && comboBox.IsLoaded == true && (int)currentOperation == comboBox.SelectedIndex) { return; } currentOperation = (OperationType)((sender as ComboBox).SelectedItem); if (OperationType.Blur == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Blur"; } else if (OperationType.Contours == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Contours"; } else if (OperationType.Canny == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Canny"; } else if (OperationType.HoughLines == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Line detection"; } else if (OperationType.MotionDetector == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Motion detection"; } else { this.CurrentOperationTextBlock.Text = string.Empty; } rootPage.algorithms[OperationComboBox.SelectedIndex].ResetEnable(); storeditem = rootPage.algorithms[OperationComboBox.SelectedIndex]; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { collection.ItemsSource = Algorithm.GetObjects(storeditem); }); if (cacheFrame != null) { await ProcessWithOpenCV(cacheFrame); } }
private async void OperationComboBox_SelectionChanged(object sender, RoutedEventArgs e) { //UpdateAlgorithm(_storeditem); currentOperation = (OperationType)((sender as ComboBox).SelectedItem); if (OperationType.Contours != currentOperation) { App.container.Visibility = Visibility.Collapsed; } else { App.container.Visibility = Visibility.Visible; } if (OperationType.Blur == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Blur"; } else if (OperationType.Contours == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Contours"; } else if (OperationType.Histogram == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Histogram of RGB channels"; } else if (OperationType.HoughLines == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Line detection"; } else if (OperationType.Canny == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Canny"; } else if (OperationType.MotionDetector == currentOperation) { this.CurrentOperationTextBlock.Text = "Current: Motion detection"; } else { this.CurrentOperationTextBlock.Text = string.Empty; } rootPage.algorithms[OperationComboBox.SelectedIndex].ResetEnable(); _storeditem = rootPage.algorithms[OperationComboBox.SelectedIndex]; await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { collection.ItemsSource = Algorithm.GetObjects(_storeditem); }); }
private async void OnCollectionItemClick(object sender, ItemClickEventArgs e) { // Get the collection item corresponding to the clicked item. var container = collection.ContainerFromItem(e.ClickedItem) as ListViewItem; if (container != null) { // Stash the clicked item for use later. We'll need it when we connect back from the detailpage. StoredProperty = container.Content as AlgorithmProperty; storeditem.RevertEnable(StoredProperty.ParameterName); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () => { collection.ItemsSource = Algorithm.GetObjects(storeditem); }); } }