6
6
using System . Linq ;
7
7
using System . Windows ;
8
8
using System . Windows . Documents ;
9
- using Flow . Launcher . Helper ;
10
9
using Flow . Launcher . Infrastructure ;
11
10
using Flow . Launcher . Infrastructure . Logger ;
12
11
using Flow . Launcher . Plugin . SharedCommands ;
12
+ using Flow . Launcher . Infrastructure . Exception ;
13
13
14
14
namespace Flow . Launcher
15
15
{
@@ -43,32 +43,36 @@ private void SetException(Exception exception)
43
43
var log = directory . GetFiles ( ) . OrderByDescending ( f => f . LastWriteTime ) . First ( ) ;
44
44
45
45
var websiteUrl = exception switch
46
- {
47
- FlowPluginException pluginException => GetIssuesUrl ( pluginException . Metadata . Website ) ,
48
- _ => Constant . IssuesUrl
49
- } ;
50
-
46
+ {
47
+ FlowPluginException pluginException => GetIssuesUrl ( pluginException . Metadata . Website ) ,
48
+ _ => Constant . IssuesUrl
49
+ } ;
51
50
52
- var paragraph = Hyperlink ( "Please open new issue in: " , websiteUrl ) ;
53
- paragraph . Inlines . Add ( $ "1. upload log file: { log . FullName } \n ") ;
54
- paragraph . Inlines . Add ( $ "2. copy below exception message") ;
51
+ var paragraph = Hyperlink ( App . API . GetTranslation ( "reportWindow_please_open_issue" ) , websiteUrl ) ;
52
+ paragraph . Inlines . Add ( string . Format ( App . API . GetTranslation ( "reportWindow_upload_log" ) , log . FullName ) ) ;
53
+ paragraph . Inlines . Add ( "\n " ) ;
54
+ paragraph . Inlines . Add ( App . API . GetTranslation ( "reportWindow_copy_below" ) ) ;
55
55
ErrorTextbox . Document . Blocks . Add ( paragraph ) ;
56
56
57
57
StringBuilder content = new StringBuilder ( ) ;
58
- content . AppendLine ( ErrorReporting . RuntimeInfo ( ) ) ;
59
- content . AppendLine ( ErrorReporting . DependenciesInfo ( ) ) ;
60
- content . AppendLine ( $ "Date: { DateTime . Now . ToString ( CultureInfo . InvariantCulture ) } ") ;
61
- content . AppendLine ( "Exception:" ) ;
58
+ content . AppendLine ( RuntimeInfo ( ) ) ;
59
+ content . AppendLine ( ) ;
60
+ content . AppendLine ( DependenciesInfo ( ) ) ;
61
+ content . AppendLine ( ) ;
62
+ content . AppendLine ( string . Format ( App . API . GetTranslation ( "reportWindow_date" ) , DateTime . Now . ToString ( CultureInfo . InvariantCulture ) ) ) ;
63
+ content . AppendLine ( App . API . GetTranslation ( "reportWindow_exception" ) ) ;
62
64
content . AppendLine ( exception . ToString ( ) ) ;
63
65
paragraph = new Paragraph ( ) ;
64
66
paragraph . Inlines . Add ( content . ToString ( ) ) ;
65
67
ErrorTextbox . Document . Blocks . Add ( paragraph ) ;
66
68
}
67
69
68
- private Paragraph Hyperlink ( string textBeforeUrl , string url )
70
+ private static Paragraph Hyperlink ( string textBeforeUrl , string url )
69
71
{
70
- var paragraph = new Paragraph ( ) ;
71
- paragraph . Margin = new Thickness ( 0 ) ;
72
+ var paragraph = new Paragraph
73
+ {
74
+ Margin = new Thickness ( 0 )
75
+ } ;
72
76
73
77
var link = new Hyperlink
74
78
{
@@ -79,10 +83,38 @@ private Paragraph Hyperlink(string textBeforeUrl, string url)
79
83
link . Click += ( s , e ) => SearchWeb . OpenInBrowserTab ( url ) ;
80
84
81
85
paragraph . Inlines . Add ( textBeforeUrl ) ;
86
+ paragraph . Inlines . Add ( " " ) ;
82
87
paragraph . Inlines . Add ( link ) ;
83
88
paragraph . Inlines . Add ( "\n " ) ;
84
89
85
90
return paragraph ;
86
91
}
92
+
93
+ private void BtnCancel_OnClick ( object sender , RoutedEventArgs e )
94
+ {
95
+ Close ( ) ;
96
+ }
97
+
98
+ private static string RuntimeInfo ( )
99
+ {
100
+ var info =
101
+ $ """
102
+ Flow Launcher { App . API . GetTranslation ( "reportWindow_version" ) } : { Constant . Version }
103
+ OS { App . API . GetTranslation ( "reportWindow_version" ) } : { ExceptionFormatter . GetWindowsFullVersionFromRegistry ( ) }
104
+ IntPtr { App . API . GetTranslation ( "reportWindow_length" ) } : { IntPtr . Size }
105
+ x64: { Environment . Is64BitOperatingSystem }
106
+ """ ;
107
+ return info ;
108
+ }
109
+
110
+ private static string DependenciesInfo ( )
111
+ {
112
+ var info =
113
+ $ """
114
+ { App . API . GetTranslation ( "pythonFilePath" ) } : { Constant . PythonPath }
115
+ { App . API . GetTranslation ( "nodeFilePath" ) } : { Constant . NodePath }
116
+ """ ;
117
+ return info ;
118
+ }
87
119
}
88
120
}
0 commit comments