private async void PercentageOfCustomMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { ColorAreaDialog dialog = new ColorAreaDialog(); ContentDialogResult result = await dialog.ShowAsync(); if (result == ContentDialogResult.Secondary) { PercentagAreasData output = PercentageAreasDetectorHelper.Calculate(WriteableOutputImage, x => x.H >= dialog.Hmin && x.H <= dialog.Hmax && x.S >= dialog.Smin && x.S <= dialog.Smax && x.L >= dialog.Lmin && x.L <= dialog.Lmax); await CallShowResultDialog(output, "Percentage of custom query"); } else { // The user clicked the CLoseButton, pressed ESC, Gamepad B, or the system back button. // Do nothing. } }
private async Task CallShowResultDialog(PercentagAreasData output, string title) { await ShowResultsDialog(title, $"{output.DetectedPixels}/{output.TotalPixels} | {(output.Percentage * 100).ToString("N2")}%"); }
private async void PercentageOfBlueMenuFlyoutItem_Click(object sender, RoutedEventArgs e) { PercentagAreasData output = PercentageAreasDetectorHelper.CalculateBlue(WriteableOutputImage); await CallShowResultDialog(output, "Percentage of blue"); }