mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve report window with dark theme & localization support
This commit is contained in:
parent
41733615fd
commit
44aa17d7c9
3 changed files with 134 additions and 37 deletions
|
|
@ -383,6 +383,12 @@
|
|||
<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_flowlauncher_got_an_error">Flow Launcher got an error</system:String>
|
||||
<system:String x:Key="reportWindow_please_open_issue">Please open new issue in</system:String>
|
||||
<system:String x:Key="reportWindow_upload_log">1. Upload log file: {0}</system:String>
|
||||
<system:String x:Key="reportWindow_copy_below">2. Copy below exception message</system:String>
|
||||
<system:String x:Key="reportWindow_date">Date: {0}</system:String>
|
||||
<system:String x:Key="reportWindow_exception">Exception:</system:String>
|
||||
<system:String x:Key="reportWindow_length">Length</system:String>
|
||||
|
||||
<!-- General Notice -->
|
||||
<system:String x:Key="pleaseWait">Please wait...</system:String>
|
||||
|
|
|
|||
|
|
@ -1,23 +1,82 @@
|
|||
<Window x:Class="Flow.Launcher.ReportWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
Icon="Images/app_error.png"
|
||||
Topmost="True"
|
||||
ResizeMode="NoResize"
|
||||
Width="600"
|
||||
Height="455"
|
||||
Title="{DynamicResource reportWindow_flowlauncher_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
|
||||
x:Class="Flow.Launcher.ReportWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
Title="{DynamicResource reportWindow_flowlauncher_got_an_error}"
|
||||
Width="600"
|
||||
Height="455"
|
||||
d:DesignHeight="300"
|
||||
d:DesignWidth="600"
|
||||
x:ClassModifier="internal"
|
||||
Background="{DynamicResource PopuBGColor}"
|
||||
Foreground="{DynamicResource PopupTextColor}"
|
||||
Icon="/Images/app_error.png"
|
||||
ResizeMode="NoResize"
|
||||
Topmost="True"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome CaptionHeight="32" ResizeBorderThickness="{x:Static SystemParameters.WindowResizeBorderThickness}" />
|
||||
</WindowChrome.WindowChrome>
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Image
|
||||
Grid.Column="0"
|
||||
Width="16"
|
||||
Height="16"
|
||||
Margin="10 4 4 4"
|
||||
RenderOptions.BitmapScalingMode="HighQuality"
|
||||
Source="/Images/app_error.png" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
Margin="4 0 0 0"
|
||||
VerticalAlignment="Center"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource Color05B}"
|
||||
Text="{DynamicResource reportWindow_flowlauncher_got_an_error}" />
|
||||
<Button
|
||||
Grid.Column="2"
|
||||
Click="BtnCancel_OnClick"
|
||||
Style="{StaticResource TitleBarCloseButtonStyle}">
|
||||
<Path
|
||||
Width="46"
|
||||
Height="32"
|
||||
Data="M 18,11 27,20 M 18,20 27,11"
|
||||
Stroke="{Binding Path=Foreground, RelativeSource={RelativeSource AncestorType={x:Type Button}}}"
|
||||
StrokeThickness="1">
|
||||
<Path.Style>
|
||||
<Style TargetType="Path">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Path=IsActive, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" Value="False">
|
||||
<Setter Property="Opacity" Value="0.5" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Path.Style>
|
||||
</Path>
|
||||
</Button>
|
||||
</Grid>
|
||||
<RichTextBox
|
||||
x:Name="ErrorTextbox"
|
||||
Grid.Row="1"
|
||||
Margin="10"
|
||||
BorderThickness="0"
|
||||
FontSize="14"
|
||||
HorizontalScrollBarVisibility="Auto"
|
||||
IsDocumentEnabled="True"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
|
|
|||
|
|
@ -6,10 +6,10 @@ using System.Text;
|
|||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Documents;
|
||||
using Flow.Launcher.Helper;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.Logger;
|
||||
using Flow.Launcher.Plugin.SharedCommands;
|
||||
using Flow.Launcher.Infrastructure.Exception;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -43,32 +43,36 @@ namespace Flow.Launcher
|
|||
var log = directory.GetFiles().OrderByDescending(f => f.LastWriteTime).First();
|
||||
|
||||
var websiteUrl = exception switch
|
||||
{
|
||||
FlowPluginException pluginException =>GetIssuesUrl(pluginException.Metadata.Website),
|
||||
_ => Constant.IssuesUrl
|
||||
};
|
||||
|
||||
{
|
||||
FlowPluginException pluginException =>GetIssuesUrl(pluginException.Metadata.Website),
|
||||
_ => Constant.IssuesUrl
|
||||
};
|
||||
|
||||
var paragraph = Hyperlink("Please open new issue in: ", websiteUrl);
|
||||
paragraph.Inlines.Add($"1. upload log file: {log.FullName}\n");
|
||||
paragraph.Inlines.Add($"2. copy below exception message");
|
||||
var paragraph = Hyperlink(App.API.GetTranslation("reportWindow_please_open_issue"), websiteUrl);
|
||||
paragraph.Inlines.Add(string.Format(App.API.GetTranslation("reportWindow_upload_log"), log.FullName));
|
||||
paragraph.Inlines.Add("\n");
|
||||
paragraph.Inlines.Add(App.API.GetTranslation("reportWindow_copy_below"));
|
||||
ErrorTextbox.Document.Blocks.Add(paragraph);
|
||||
|
||||
StringBuilder content = new StringBuilder();
|
||||
content.AppendLine(ErrorReporting.RuntimeInfo());
|
||||
content.AppendLine(ErrorReporting.DependenciesInfo());
|
||||
content.AppendLine($"Date: {DateTime.Now.ToString(CultureInfo.InvariantCulture)}");
|
||||
content.AppendLine("Exception:");
|
||||
content.AppendLine(RuntimeInfo());
|
||||
content.AppendLine();
|
||||
content.AppendLine(DependenciesInfo());
|
||||
content.AppendLine();
|
||||
content.AppendLine(string.Format(App.API.GetTranslation("reportWindow_date"), DateTime.Now.ToString(CultureInfo.InvariantCulture)));
|
||||
content.AppendLine(App.API.GetTranslation("reportWindow_exception"));
|
||||
content.AppendLine(exception.ToString());
|
||||
paragraph = new Paragraph();
|
||||
paragraph.Inlines.Add(content.ToString());
|
||||
ErrorTextbox.Document.Blocks.Add(paragraph);
|
||||
}
|
||||
|
||||
private Paragraph Hyperlink(string textBeforeUrl, string url)
|
||||
private static Paragraph Hyperlink(string textBeforeUrl, string url)
|
||||
{
|
||||
var paragraph = new Paragraph();
|
||||
paragraph.Margin = new Thickness(0);
|
||||
var paragraph = new Paragraph
|
||||
{
|
||||
Margin = new Thickness(0)
|
||||
};
|
||||
|
||||
var link = new Hyperlink
|
||||
{
|
||||
|
|
@ -79,10 +83,38 @@ namespace Flow.Launcher
|
|||
link.Click += (s, e) => SearchWeb.OpenInBrowserTab(url);
|
||||
|
||||
paragraph.Inlines.Add(textBeforeUrl);
|
||||
paragraph.Inlines.Add(" ");
|
||||
paragraph.Inlines.Add(link);
|
||||
paragraph.Inlines.Add("\n");
|
||||
|
||||
return paragraph;
|
||||
}
|
||||
|
||||
private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
private static string RuntimeInfo()
|
||||
{
|
||||
var info =
|
||||
$"""
|
||||
Flow Launcher {App.API.GetTranslation("reportWindow_version")}: {Constant.Version}
|
||||
OS {App.API.GetTranslation("reportWindow_version")}: {ExceptionFormatter.GetWindowsFullVersionFromRegistry()}
|
||||
IntPtr {App.API.GetTranslation("reportWindow_length")}: {IntPtr.Size}
|
||||
x64: {Environment.Is64BitOperatingSystem}
|
||||
""";
|
||||
return info;
|
||||
}
|
||||
|
||||
private static string DependenciesInfo()
|
||||
{
|
||||
var info =
|
||||
$"""
|
||||
{App.API.GetTranslation("pythonFilePath")}: {Constant.PythonPath}
|
||||
{App.API.GetTranslation("nodeFilePath")}: {Constant.NodePath}
|
||||
""";
|
||||
return info;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue