mirror of
https://github.com/microsoft/PowerToys.git
synced 2024-12-12 10:19:20 +08:00
[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 commit8b2812e2de
. * Revert "Fixed wrapping for KBM subtitle textblock" This reverts commitaa9ec54121
. * Revert "Updated adaptive trigger behavior" This reverts commite6f4ed27a1
. * Update ReportWindow.xaml.cs * Update ReportWindow.xaml.cs * Update ReportWindow.xaml.cs * Removed redundant code, fixed trailing issue Co-authored-by: Niels Laute <niels9001@hotmail.com>
This commit is contained in:
parent
8f8b200f24
commit
dad8cbecc1
@ -130,7 +130,7 @@
|
||||
<system:String x:Key="reportWindow_sending">Sending</system:String>
|
||||
<system:String x:Key="reportWindow_report_succeed">Report sent successfully</system:String>
|
||||
<system:String x:Key="reportWindow_report_failed">Failed to send report</system:String>
|
||||
<system:String x:Key="reportWindow_wox_got_an_error">PT Run got an error</system:String>
|
||||
<system:String x:Key="reportWindow_wox_got_an_error">PowerToys Run ran into an issue</system:String>
|
||||
|
||||
<!--update-->
|
||||
<system:String x:Key="update_wox_update_new_version_available">New Wox release {0} is now available</system:String>
|
||||
|
@ -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">
|
||||
<RichTextBox x:Name="ErrorTextbox"
|
||||
IsDocumentEnabled="True"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
FontSize="14"
|
||||
Margin="10"
|
||||
BorderThickness="0"/>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="pack://application:,,,/Styles/ModernScrollBarStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid Margin="24">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="64"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Text="Something went wrong."
|
||||
FontFamily="Segoe UI Light"
|
||||
FontSize="32"
|
||||
Foreground="{DynamicResource ControlTextBrushKey}"/>
|
||||
|
||||
<TextBlock FontSize="14"
|
||||
Grid.Row="1"
|
||||
TextWrapping="Wrap"
|
||||
|
||||
Foreground="{DynamicResource ControlTextBrushKey}">
|
||||
<Run Text="Please file a bug in the"/>
|
||||
<Hyperlink x:Name="RepositoryHyperlink" Click="RepositoryHyperlink_Click" FontWeight="SemiBold" NavigateUri="https://aka.ms/powerToysReportBug">PowerToys GitHub repository</Hyperlink><Run Text="."/>
|
||||
<Run Text="Make sure to upload the log file and to include the error message."/>
|
||||
</TextBlock>
|
||||
|
||||
<TextBox Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Grid.Row="2"
|
||||
x:Name="LogFilePathBox"
|
||||
Margin="0,16,0,0"
|
||||
FontSize="14"
|
||||
FontFamily="Consolas"
|
||||
Foreground="{DynamicResource ControlTextBrushKey}"
|
||||
IsReadOnly="True"
|
||||
TextWrapping="Wrap">
|
||||
</TextBox>
|
||||
|
||||
|
||||
|
||||
<RichTextBox x:Name="ErrorTextbox"
|
||||
Grid.Row="3"
|
||||
BorderBrush="{DynamicResource ScrollBarThumbBackground}"
|
||||
BorderThickness="1"
|
||||
Background="Transparent"
|
||||
IsDocumentEnabled="True"
|
||||
Foreground="{DynamicResource ControlTextBrushKey}"
|
||||
VerticalAlignment="Stretch"
|
||||
FontFamily="Consolas"
|
||||
VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
FontSize="14"/>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user