Add crashwindow
MODIFY
WalletWasabi.Gui/CrashReport/CrashReportApp.xaml.cs
WalletWasabi.Gui/CrashReport/CrashReportApp.xaml.cs
@@ -10,7 +10,7 @@ namespace WalletWasabi.Gui.CrashReport
{
public CrashReportApp()
{
- Name = "Wasabi Wallet Crash Reporting";
+ Name = "WasabiWallet Crash Report";
}
public override void Initialize()

MODIFY
WalletWasabi.Gui/CrashReport/CrashReporter.cs
WalletWasabi.Gui/CrashReport/CrashReporter.cs
@@ -48,7 +48,7 @@ namespace WalletWasabi.Gui.CrashReport
/// </summary>
public void SetException(Exception ex)
{
- SetException(SerializedException.ToCommandLineArgument(ex), 1);
+ SetException(SerializedException.ToCommandLineString(ex), 1);
}
public override string ToString()
@@ -63,5 +63,10 @@ namespace WalletWasabi.Gui.CrashReport
return exceptionToDisplay;
}
+
+ public SerializedException GetException()
+ {
+ return SerializedException.ToSerializedException(ExceptionString);
+ }
}
}

MODIFY
WalletWasabi.Gui/CrashReport/Models/SerializedException.cs
WalletWasabi.Gui/CrashReport/Models/SerializedException.cs
@@ -19,6 +19,10 @@ namespace WalletWasabi.Gui.CrashReport.Models
[JsonProperty(PropertyName = "InnerException")]
public SerializedException InnerException { get; set; }
+ public SerializedException()
+ {
+ }
+
public SerializedException(Exception ex)
{
if (ex.InnerException != null)
@@ -100,9 +104,16 @@ namespace WalletWasabi.Gui.CrashReport.Models
return n == 0 ? string.Empty : new string(' ', n * 4);
}
- public static string ToCommandLineArgument(Exception serializedException)
+ public static string ToCommandLineString(Exception exception)
+ {
+ return Convert.ToBase64String(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(new SerializedException(exception))));
+ }
+
+ public static SerializedException ToSerializedException(string serializedException)
{
- return JsonConvert.SerializeObject(new SerializedException(serializedException));
+ var json = Encoding.UTF8.GetString(Convert.FromBase64String(serializedException));
+ var se = JsonConvert.DeserializeObject<SerializedException>(json);
+ return se;
}
}
}

MODIFY
WalletWasabi.Gui/CrashReport/ViewModels/CrashReportWindowViewModel.cs
WalletWasabi.Gui/CrashReport/ViewModels/CrashReportWindowViewModel.cs
@@ -6,13 +6,22 @@ namespace WalletWasabi.Gui.CrashReport.ViewModels
{
public CrashReportWindowViewModel()
{
- Global = Locator.Current.GetService<Global>();
+ var global = Locator.Current.GetService<Global>();
+ CrashReporter = global.CrashReporter;
}
- public int WinWidth => 640;
- public int WinHeight => 360;
+ private CrashReporter CrashReporter { get; }
+ public int MinWidth => 370;
+ public int MinHeight => 180;
public string Title => "Wasabi Wallet - Crash Reporting";
- public string ReportedException => Global.CrashReporter.ToString();
- public Global Global { get; }
+ public string Details => CrashReporter.GetException().ToString();
+
+ public string Message
+ {
+ get
+ {
+ return CrashReporter.GetException().Message;
+ }
+ }
}
}

MODIFY
WalletWasabi.Gui/CrashReport/Views/CrashReportWindow.xaml
WalletWasabi.Gui/CrashReport/Views/CrashReportWindow.xaml
x:Class="WalletWasabi.Gui.CrashReport.Views.CrashReportWindow"
Icon="avares://WalletWasabi.Gui/Assets/WasabiLogo256.png"
Title="{Binding Title}"
- Width="{Binding WinWidth}" Height="{Binding WinHeight}"
- MinWidth="{Binding WinWidth}" MinHeight="{Binding WinHeight}"
- MaxWidth="{Binding WinWidth}" MaxHeight="{Binding WinHeight}"
+ MinWidth="{Binding MinWidth}" MinHeight="{Binding MinHeight}"
FontFamily="{DynamicResource UiFont}" FontSize="14"
Foreground="{DynamicResource ThemeForegroundBrush}"
- WindowState="{Binding WindowState}">
- <Grid ColumnDefinitions="*,*" RowDefinitions="*,Auto">
- <TextBox Grid.ColumnSpan="2" Grid.RowSpan="1" Classes="monospaceFont" AcceptsReturn="True" Text="{Binding ReportedException}" />
- </Grid>
+ WindowState="{Binding WindowState}"
+ Classes="ToolWindow">
+ <DockPanel LastChildFill="True" Margin="25,0,25,25">
+ <StackPanel DockPanel.Dock="Bottom" Orientation="Horizontal" HorizontalAlignment="Right" Spacing="5">
+ <Button MinWidth="135" Height="35">Open logs</Button>
+ <Button MinWidth="135" Height="35" Background="{DynamicResource ThemeAccentBrush}">Ok</Button>
+ </StackPanel>
+ <TextBlock DockPanel.Dock="Top" FontWeight="Bold" FontSize="18" Margin="0,0,0,25" Text="{Binding Message}" />
+ <TextBlock Text="{Binding Details}" />
+ </DockPanel>
</cont:MetroWindow>

MODIFY
WalletWasabi.Gui/Global.cs
WalletWasabi.Gui/Global.cs
@@ -123,7 +123,6 @@ namespace WalletWasabi.Gui
try
{
- throw new Exception("my dummy exception");
Cache = new MemoryCache(new MemoryCacheOptions
{
SizeLimit = 1_000,

MODIFY
WalletWasabi.Gui/Properties/launchSettings.json
WalletWasabi.Gui/Properties/launchSettings.json
{
"profiles": {
"WalletWasabi.Gui": {
- "commandName": "Project"
+ "commandName": "Project",
+ "commandLineArgs": "crashreport -attempt=2 -exception=eyJFeGNlcHRpb25UeXBlIjoiU3lzdGVtLkV4Y2VwdGlvbiIsIk1lc3NhZ2UiOiJteSBkdW1teSBleGNlcHRpb24iLCJTdGFja1RyYWNlIjoiICAgYXQgV2FsbGV0V2FzYWJpLkd1aS5HbG9iYWwuSW5pdGlhbGl6ZU5vV2FsbGV0QXN5bmMoKSBpbiBDOlxcd29ya1xcV2FsbGV0V2FzYWJpXFxXYWxsZXRXYXNhYmkuR3VpXFxHbG9iYWwuY3M6bGluZSAxMjZcclxuICAgYXQgV2FsbGV0V2FzYWJpLkd1aS5Qcm9ncmFtLkFwcE1haW5Bc3luYyhTdHJpbmdbXSBhcmdzKSBpbiBDOlxcd29ya1xcV2FsbGV0V2FzYWJpXFxXYWxsZXRXYXNhYmkuR3VpXFxQcm9ncmFtLmNzOmxpbmUgNzEiLCJJbm5lckV4Y2VwdGlvbiI6bnVsbH0="
}
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Gui/Styles/Styles.xaml
WalletWasabi.Gui/Styles/Styles.xaml
<Style Selector="dock|ProportionalStackPanelSplitter">
<Setter Property="IsHitTestVisible" Value="False" />
</Style>
+
+ <Style Selector="shell|MetroWindow.ToolWindow /template/ Button#minimiseButton">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
+ <Style Selector="shell|MetroWindow.ToolWindow /template/ Button#restoreButton">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
+ <Style Selector="shell|MetroWindow.ToolWindow /template/ Image">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
+ <Style Selector="shell|MetroWindow.ToolWindow /template/ Border > VisualLayerManager > Grid > Grid > Grid > Grid > TextBlock">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
+ <Style Selector="shell|MetroWindow.ToolWindow /template/ DockPanel#titlebar > ContentControl">
+ <Setter Property="IsVisible" Value="False" />
+ </Style>
</Styles>

Add crashwindow