feat(关于面板): 添加反馈问题按钮及功能

在关于面板中添加反馈问题按钮,点击后收集系统信息并跳转到GitHub问题提交页面

Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com>
This commit is contained in:
doudou0720
2026-03-21 23:17:51 +08:00
parent c70d8e1c4e
commit f9f4e20c65
2 changed files with 132 additions and 0 deletions
@@ -178,6 +178,41 @@
</Image>
</StackPanel>
</Grid>
<Border Height="1" Background="#ebebeb"/>
<Grid Height="54">
<TextBlock Foreground="#2e3436" FontSize="14.5" Text="反馈问题" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="18,0,0,0"/>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,18,0">
<Button Name="BtnReportIssue" Content="提交反馈" Padding="12,6" Click="BtnReportIssue_Click" Cursor="Hand">
<Button.Style>
<Style TargetType="Button">
<Setter Property="Background" Value="#FF1d4ed8"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FontSize" Value="13"/>
<Setter Property="Cursor" Value="Hand"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="4"
Padding="{TemplateBinding Padding}">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="#FF1e40af"/>
</Trigger>
</Style.Triggers>
</Style>
</Button.Style>
</Button>
</StackPanel>
</Grid>
</StackPanel>
</Border>
<StackPanel Orientation="Vertical" Margin="0,16,0,0">
@@ -460,6 +460,103 @@ namespace Ink_Canvas.Windows.SettingsViews
}
}
private void BtnReportIssue_Click(object sender, RoutedEventArgs e)
{
try
{
string version = "";
string updateChannel = "";
string osInfo = "";
string netVersion = "";
string touchSupport = "";
try
{
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version;
version = $"v{assemblyVersion}";
}
catch (Exception ex)
{
version = "未知";
System.Diagnostics.Debug.WriteLine($"获取软件版本失败: {ex.Message}");
}
try
{
if (MainWindow.Settings?.Startup != null)
{
updateChannel = MainWindow.Settings.Startup.UpdateChannel.ToString();
}
}
catch (Exception ex)
{
updateChannel = "未知";
System.Diagnostics.Debug.WriteLine($"获取更新通道失败: {ex.Message}");
}
try
{
osInfo = $"{OSVersion.GetOperatingSystem()} {OSVersion.GetOSVersion().Version}";
}
catch (Exception ex)
{
osInfo = "未知";
System.Diagnostics.Debug.WriteLine($"获取系统版本失败: {ex.Message}");
}
try
{
netVersion = RuntimeInformation.FrameworkDescription;
}
catch (Exception ex)
{
netVersion = "未知";
System.Diagnostics.Debug.WriteLine($"获取.NET版本失败: {ex.Message}");
}
try
{
var support = TouchTabletDetectHelper.IsTouchEnabled();
var touchcount = TouchTabletDetectHelper.GetTouchTabletDevices().Count;
if (support)
{
if (touchcount > 0)
{
touchSupport = $"支持({touchcount}个设备)";
}
else
{
touchSupport = "支持";
}
}
else
{
touchSupport = "不支持";
}
}
catch (Exception ex)
{
touchSupport = "未知";
System.Diagnostics.Debug.WriteLine($"获取触控支持失败: {ex.Message}");
}
string versionInfo = $"{version} ({updateChannel})";
string systemInfo = $"{osInfo} | {netVersion} | 触控:{touchSupport}";
string url = $"https://github.com/InkCanvasForClass/community/issues/new?template=01-bug_report.yml&version={Uri.EscapeDataString(versionInfo)}&os={Uri.EscapeDataString(systemInfo)}";
Process.Start(new ProcessStartInfo
{
FileName = url,
UseShellExecute = true
});
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"打开反馈链接失败: {ex.Message}");
}
}
/// <summary>
/// 应用主题
/// </summary>