feature<Issue>: add preference setting to enable/disable crash report

This commit is contained in:
leo 2021-08-11 10:02:57 +08:00
parent 7a06756fe9
commit 780b4b9d18
5 changed files with 33 additions and 17 deletions

View file

@ -24,6 +24,8 @@ namespace SourceGit.Models {
/// </summary> /// </summary>
/// <param name="e"></param> /// <param name="e"></param>
public static void Create(System.Exception e) { public static void Create(System.Exception e) {
if (!Preference.Instance.General.EnableCrashReport) return;
try { try {
var issue = new Issue(); var issue = new Issue();
issue.AccessToken = "d0d56410f13a3826b87fb0868d5a26ce"; // 这是我个人的Token仅启用ISSUE创建功能请不要使用 issue.AccessToken = "d0d56410f13a3826b87fb0868d5a26ce"; // 这是我个人的Token仅启用ISSUE创建功能请不要使用

View file

@ -72,6 +72,11 @@ namespace SourceGit.Models {
/// 启用自动拉取远程变更每10分钟一次 /// 启用自动拉取远程变更每10分钟一次
/// </summary> /// </summary>
public bool AutoFetchRemotes { get; set; } = true; public bool AutoFetchRemotes { get; set; } = true;
/// <summary>
/// 是否启用崩溃上报
/// </summary>
public bool EnableCrashReport { get; set; } = false;
} }
/// <summary> /// <summary>

View file

@ -362,6 +362,7 @@
<sys:String x:Key="Text.Preference.CheckUpdate">Check for update</sys:String> <sys:String x:Key="Text.Preference.CheckUpdate">Check for update</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">Fetch remotes automatically (need restart)</sys:String> <sys:String x:Key="Text.Preference.AutoFetch">Fetch remotes automatically (need restart)</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">Restore windows</sys:String> <sys:String x:Key="Text.Preference.RestoreTabs">Restore windows</sys:String>
<sys:String x:Key="Text.Preference.EnableCrashReport">Enable crash report (maybe include related path)</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT SETTING</sys:String> <sys:String x:Key="Text.Preference.Git">GIT SETTING</sys:String>
<sys:String x:Key="Text.Preference.Git.Path">Install Path</sys:String> <sys:String x:Key="Text.Preference.Git.Path">Install Path</sys:String>
<sys:String x:Key="Text.Preference.Git.Path.Placeholder">Input path for git.exe</sys:String> <sys:String x:Key="Text.Preference.Git.Path.Placeholder">Input path for git.exe</sys:String>

View file

@ -361,6 +361,7 @@
<sys:String x:Key="Text.Preference.CheckUpdate">启用检测更新</sys:String> <sys:String x:Key="Text.Preference.CheckUpdate">启用检测更新</sys:String>
<sys:String x:Key="Text.Preference.AutoFetch">启用定时自动拉取远程更新(重启生效)</sys:String> <sys:String x:Key="Text.Preference.AutoFetch">启用定时自动拉取远程更新(重启生效)</sys:String>
<sys:String x:Key="Text.Preference.RestoreTabs">启动时恢复上次打开的仓库</sys:String> <sys:String x:Key="Text.Preference.RestoreTabs">启动时恢复上次打开的仓库</sys:String>
<sys:String x:Key="Text.Preference.EnableCrashReport">开启崩溃上报(可能涉及上报相关路径)</sys:String>
<sys:String x:Key="Text.Preference.Git">GIT配置</sys:String> <sys:String x:Key="Text.Preference.Git">GIT配置</sys:String>
<sys:String x:Key="Text.Preference.Git.Path">安装路径</sys:String> <sys:String x:Key="Text.Preference.Git.Path">安装路径</sys:String>
<sys:String x:Key="Text.Preference.Git.Path.Placeholder">填写git.exe所在位置</sys:String> <sys:String x:Key="Text.Preference.Git.Path.Placeholder">填写git.exe所在位置</sys:String>

View file

@ -64,6 +64,7 @@
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="8"/> <RowDefinition Height="8"/>
<RowDefinition Height="36"/> <RowDefinition Height="36"/>
<RowDefinition Height="28"/> <RowDefinition Height="28"/>
@ -181,20 +182,26 @@
Content="{DynamicResource Text.Preference.RestoreTabs}" Content="{DynamicResource Text.Preference.RestoreTabs}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/> IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=Restore.IsEnabled, Mode=TwoWay}"/>
<!-- Crash Report -->
<CheckBox
Grid.Row="8" Grid.Column="1"
Content="{DynamicResource Text.Preference.EnableCrashReport}"
IsChecked="{Binding Source={x:Static models:Preference.Instance}, Path=General.EnableCrashReport, Mode=TwoWay}"/>
<!-- Git Group --> <!-- Git Group -->
<TextBlock <TextBlock
Grid.Row="9" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="10" Grid.Column="0" Grid.ColumnSpan="2"
Text="{DynamicResource Text.Preference.Git}" Text="{DynamicResource Text.Preference.Git}"
FontSize="16" FontWeight="DemiBold" FontSize="16" FontWeight="DemiBold"
Foreground="{DynamicResource Brush.FG2}"/> Foreground="{DynamicResource Brush.FG2}"/>
<!-- Git Executable Path --> <!-- Git Executable Path -->
<TextBlock <TextBlock
Grid.Row="10" Grid.Column="0" Grid.Row="11" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Path}" Text="{DynamicResource Text.Preference.Git.Path}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<Grid Grid.Row="10" Grid.Column="1"> <Grid Grid.Row="11" Grid.Column="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -217,11 +224,11 @@
<!-- Default Clone Dir --> <!-- Default Clone Dir -->
<TextBlock <TextBlock
Grid.Row="11" Grid.Column="0" Grid.Row="12" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Dir}" Text="{DynamicResource Text.Preference.Git.Dir}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<Grid Grid.Row="11" Grid.Column="1"> <Grid Grid.Row="12" Grid.Column="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
@ -244,36 +251,36 @@
<!-- User --> <!-- User -->
<TextBlock <TextBlock
Grid.Row="12" Grid.Column="0" Grid.Row="13" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.User}" Text="{DynamicResource Text.Preference.Git.User}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<controls:TextEdit <controls:TextEdit
Grid.Row="12" Grid.Column="1" Grid.Row="13" Grid.Column="1"
Height="24" Height="24"
Text="{Binding ElementName=me, Path=User, Mode=TwoWay}" Text="{Binding ElementName=me, Path=User, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.User.Placeholder}"/> Placeholder="{DynamicResource Text.Preference.Git.User.Placeholder}"/>
<!-- Email --> <!-- Email -->
<TextBlock <TextBlock
Grid.Row="13" Grid.Column="0" Grid.Row="14" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.Email}" Text="{DynamicResource Text.Preference.Git.Email}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<controls:TextEdit <controls:TextEdit
Grid.Row="13" Grid.Column="1" Grid.Row="14" Grid.Column="1"
Height="24" Height="24"
Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}" Text="{Binding ElementName=me, Path=Email, Mode=TwoWay}"
Placeholder="{DynamicResource Text.Preference.Git.Email.Placeholder}"/> Placeholder="{DynamicResource Text.Preference.Git.Email.Placeholder}"/>
<!-- CRLF --> <!-- CRLF -->
<TextBlock <TextBlock
Grid.Row="14" Grid.Column="0" Grid.Row="15" Grid.Column="0"
Text="{DynamicResource Text.Preference.Git.CRLF}" Text="{DynamicResource Text.Preference.Git.CRLF}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<ComboBox <ComboBox
Grid.Row="14" Grid.Column="1" Grid.Row="15" Grid.Column="1"
Height="24" Height="24"
ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}" ItemsSource="{Binding Source={x:Static models:CRLFOption.Supported}}"
SelectedValuePath="Value" SelectedValuePath="Value"
@ -290,19 +297,19 @@
<!-- Merge Tool Group --> <!-- Merge Tool Group -->
<TextBlock <TextBlock
Grid.Row="16" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="17" Grid.Column="0" Grid.ColumnSpan="2"
Text="{DynamicResource Text.Preference.Merger}" Text="{DynamicResource Text.Preference.Merger}"
FontSize="16" FontWeight="DemiBold" FontSize="17" FontWeight="DemiBold"
Foreground="{DynamicResource Brush.FG2}"/> Foreground="{DynamicResource Brush.FG2}"/>
<!-- Merge Tool Type --> <!-- Merge Tool Type -->
<TextBlock <TextBlock
Grid.Row="17" Grid.Column="0" Grid.Row="18" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Type}" Text="{DynamicResource Text.Preference.Merger.Type}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<ComboBox <ComboBox
Grid.Row="17" Grid.Column="1" Grid.Row="18" Grid.Column="1"
Height="24" Height="24"
ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}" ItemsSource="{Binding Source={x:Static models:MergeTool.Supported}}"
DisplayMemberPath="Name" DisplayMemberPath="Name"
@ -312,11 +319,11 @@
<!-- Merge Tool Executable Path --> <!-- Merge Tool Executable Path -->
<TextBlock <TextBlock
Grid.Row="18" Grid.Column="0" Grid.Row="19" Grid.Column="0"
Text="{DynamicResource Text.Preference.Merger.Path}" Text="{DynamicResource Text.Preference.Merger.Path}"
HorizontalAlignment="Right" HorizontalAlignment="Right"
Margin="0,0,8,0"/> Margin="0,0,8,0"/>
<Grid Grid.Row="18" Grid.Column="1"> <Grid Grid.Row="19" Grid.Column="1">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>