private async void EntropySelectionPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { AddToUndo(WriteableOutputImage.Clone()); int?threshold = null; if (ExtraThresholds.EntropySelectionCalculate(WriteableOutputImage, out threshold) == null) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); ExtraThresholds.EntropySelectionCalculate(WriteableOutputImage, out threshold); } ContentDialog dialog = new ContentDialog { Title = "Binaryzation", Content = "Entropy Selection threshold value = " + threshold ?? "[Error]", CloseButtonText = "Ok" }; ContentDialogResult result = await dialog.ShowAsync(); await UpdateOutputImage(); }
private async void PercentageBlackSelectionPageMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); PercentageBlackSelectionBinaryzationDialog dialog = new PercentageBlackSelectionBinaryzationDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { AddToUndo(WriteableOutputImage.Clone()); if (ExtraThresholds.PercentageBlackSelectionCalculate(WriteableOutputImage, dialog.TresholdValue) == null) { ConvertToGrayScaleITUR_BT709PageMenuFlyoutItem_Click(null, null); ExtraThresholds.PercentageBlackSelectionCalculate(WriteableOutputImage, dialog.TresholdValue); } await UpdateOutputImage(); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }