From dad8cbecc16c277774744f6894f25b57d6a4fd34 Mon Sep 17 00:00:00 2001 From: Niels Laute Date: Mon, 17 Aug 2020 22:48:54 +0200 Subject: [PATCH] [Launcher] ReportWindow redesign and theming support (#5790) * Updated adaptive trigger behavior * Fixed wrapping for KBM subtitle textblock * Fix * Theme support for ReportWindow * Fix * Fix * Spacing issue fix * Revert "Fix" This reverts commit 8b2812e2de6a7b208d07c5e0f6f4cabdb9a21940. * Revert "Fixed wrapping for KBM subtitle textblock" This reverts commit aa9ec54121203b8d83d67dc28f857bedb5d174c3. * Revert "Updated adaptive trigger behavior" This reverts commit e6f4ed27a137a4ba7a2d06a1fe42b42a1482c036. * Update ReportWindow.xaml.cs * Update ReportWindow.xaml.cs * Update ReportWindow.xaml.cs * Removed redundant code, fixed trailing issue Co-authored-by: Niels Laute --- .../launcher/PowerLauncher/Languages/en.xaml | 2 +- .../launcher/PowerLauncher/ReportWindow.xaml | 68 ++++++++++++++++--- .../PowerLauncher/ReportWindow.xaml.cs | 28 ++------ 3 files changed, 64 insertions(+), 34 deletions(-) diff --git a/src/modules/launcher/PowerLauncher/Languages/en.xaml b/src/modules/launcher/PowerLauncher/Languages/en.xaml index fca648f18e..75a5f930f8 100644 --- a/src/modules/launcher/PowerLauncher/Languages/en.xaml +++ b/src/modules/launcher/PowerLauncher/Languages/en.xaml @@ -130,7 +130,7 @@ Sending Report sent successfully Failed to send report - PT Run got an error + PowerToys Run ran into an issue New Wox release {0} is now available diff --git a/src/modules/launcher/PowerLauncher/ReportWindow.xaml b/src/modules/launcher/PowerLauncher/ReportWindow.xaml index 451f71879d..66f1f6c278 100644 --- a/src/modules/launcher/PowerLauncher/ReportWindow.xaml +++ b/src/modules/launcher/PowerLauncher/ReportWindow.xaml @@ -5,19 +5,69 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" WindowStartupLocation="CenterScreen" + Background="{DynamicResource SystemChromeLow}" Icon="Images/app_error.dark.png" Topmost="True" ResizeMode="NoResize" - Width="600" - Height="455" + Width="760" + Height="560" Title="{DynamicResource reportWindow_wox_got_an_error}" d:DesignHeight="300" d:DesignWidth="600" x:ClassModifier="internal"> - + + + + + + + + + + + + + + + + + + + PowerToys GitHub repository + + + + + + + + + + diff --git a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs index a22c07e16e..44d5135007 100644 --- a/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs +++ b/src/modules/launcher/PowerLauncher/ReportWindow.xaml.cs @@ -40,17 +40,14 @@ namespace PowerLauncher var directory = new DirectoryInfo(path); var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First(); - var paragraph = Hyperlink("Please open new issue in: ", Constant.Issue); - paragraph.Inlines.Add($"1. upload log file: {log.FullName}\n"); - paragraph.Inlines.Add($"2. copy below exception message"); - ErrorTextbox.Document.Blocks.Add(paragraph); + LogFilePathBox.Text = log.FullName; StringBuilder content = new StringBuilder(); content.AppendLine(ErrorReporting.RuntimeInfo()); content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}"); content.AppendLine("Exception:"); content.AppendLine(exception.ToString()); - paragraph = new Paragraph(); + var paragraph = new Paragraph(); paragraph.Inlines.Add(content.ToString()); ErrorTextbox.Document.Blocks.Add(paragraph); } @@ -78,31 +75,14 @@ namespace PowerLauncher } } - private static void LinkOnRequestNavigate(object sender, RequestNavigateEventArgs e) + private void RepositoryHyperlink_Click(object sender, RoutedEventArgs e) { - var ps = new ProcessStartInfo(e.Uri.ToString()) + var ps = new ProcessStartInfo((sender as Hyperlink).NavigateUri.ToString()) { UseShellExecute = true, Verb = "open", }; Process.Start(ps); } - - private static Paragraph Hyperlink(string textBeforeUrl, string url) - { - var paragraph = new Paragraph(); - paragraph.Margin = new Thickness(0); - - var link = new Hyperlink { IsEnabled = true }; - link.Inlines.Add(url); - link.NavigateUri = new Uri(url); - link.RequestNavigate += LinkOnRequestNavigate; - - paragraph.Inlines.Add(textBeforeUrl); - paragraph.Inlines.Add(link); - paragraph.Inlines.Add("\n"); - - return paragraph; - } } }