feat(FeedBack): 添加遥测ID支持并改进UI布局

- 新增遥测ID获取功能及相关UI控制逻辑
- 重构反馈窗口为分页式布局,增加确认页面
- 使用ModernWPF控件改进界面样式和用户体验
- 重命名控件变量以保持命名一致性

Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com>
This commit is contained in:
doudou0720
2026-03-27 23:28:25 +08:00
parent 956f3b12ac
commit 337d2f53e4
2 changed files with 331 additions and 55 deletions
+167 -14
View File
@@ -16,12 +16,13 @@ namespace Ink_Canvas
private string _netVersion = "";
private string _touchSupport = "";
private string _deviceId = "";
private string _telemetryId = "";
public FeedbackWindow()
{
InitializeComponent();
LoadInformation();
UpdatePreviewText();
CheckTelemetryIdAvailability();
}
private void LoadInformation()
@@ -105,13 +106,67 @@ namespace Ink_Canvas
_deviceId = "获取失败";
System.Diagnostics.Debug.WriteLine($"获取设备ID失败: {ex.Message}");
}
try
{
_telemetryId = GetTelemetryId();
}
catch (Exception ex)
{
_telemetryId = "获取失败";
System.Diagnostics.Debug.WriteLine($"获取遥测ID失败: {ex.Message}");
}
}
private void UpdatePreviewText()
private string GetTelemetryId()
{
TextAppVersionInfo.Text = $"{_appVersion} ({_updateChannel})";
TextSystemInfo.Text = $"{_osVersion} | {_netVersion} | 触控:{_touchSupport}";
TextDeviceInfo.Text = $"设备ID: {_deviceId}";
try
{
var telemetryIdFilePath = System.IO.Path.Combine(App.RootPath, "telemetry_id.dat");
if (System.IO.File.Exists(telemetryIdFilePath))
{
return System.IO.File.ReadAllText(telemetryIdFilePath).Trim();
}
return "";
}
catch
{
return "";
}
}
private void CheckTelemetryIdAvailability()
{
try
{
bool hasTelemetryId = CheckTelemetryIdExists();
if (!hasTelemetryId)
{
CardFanceId.Visibility = Visibility.Collapsed;
CheckFanceId.IsChecked = false;
CheckFanceId.IsEnabled = false;
}
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"检查遥测ID可用性失败: {ex.Message}");
CardFanceId.Visibility = Visibility.Collapsed;
CheckFanceId.IsChecked = false;
CheckFanceId.IsEnabled = false;
}
}
private bool CheckTelemetryIdExists()
{
try
{
var telemetryIdFilePath = System.IO.Path.Combine(App.RootPath, "telemetry_id.dat");
return System.IO.File.Exists(telemetryIdFilePath);
}
catch
{
return false;
}
}
private void ButtonCancel_Click(object sender, RoutedEventArgs e)
@@ -119,20 +174,30 @@ namespace Ink_Canvas
Close();
}
private void ButtonSubmit_Click(object sender, RoutedEventArgs e)
private void ButtonBack_Click(object sender, RoutedEventArgs e)
{
Page1.Visibility = Visibility.Visible;
Page2.Visibility = Visibility.Collapsed;
ButtonCancel.Visibility = Visibility.Visible;
ButtonNext.Visibility = Visibility.Visible;
ButtonBack.Visibility = Visibility.Collapsed;
ButtonSubmit.Visibility = Visibility.Collapsed;
}
private void ButtonNext_Click(object sender, RoutedEventArgs e)
{
try
{
string versionInfo = "";
string systemInfo = "";
if (CheckBoxAppVersion.IsChecked == true || CheckBoxUpdateChannel.IsChecked == true)
if (CheckAppVersion.IsChecked == true || CheckUpdateChannel.IsChecked == true)
{
if (CheckBoxAppVersion.IsChecked == true)
if (CheckAppVersion.IsChecked == true)
{
versionInfo += _appVersion;
}
if (CheckBoxUpdateChannel.IsChecked == true)
if (CheckUpdateChannel.IsChecked == true)
{
if (!string.IsNullOrEmpty(versionInfo))
{
@@ -142,13 +207,13 @@ namespace Ink_Canvas
}
}
if (CheckBoxOSVersion.IsChecked == true || CheckBoxNetVersion.IsChecked == true || CheckBoxTouchSupport.IsChecked == true)
if (CheckOSVersion.IsChecked == true || CheckNetVersion.IsChecked == true || CheckTouchSupport.IsChecked == true)
{
if (CheckBoxOSVersion.IsChecked == true)
if (CheckOSVersion.IsChecked == true)
{
systemInfo += _osVersion;
}
if (CheckBoxNetVersion.IsChecked == true)
if (CheckNetVersion.IsChecked == true)
{
if (!string.IsNullOrEmpty(systemInfo))
{
@@ -156,7 +221,90 @@ namespace Ink_Canvas
}
systemInfo += _netVersion;
}
if (CheckBoxTouchSupport.IsChecked == true)
if (CheckTouchSupport.IsChecked == true)
{
if (!string.IsNullOrEmpty(systemInfo))
{
systemInfo += " | ";
}
systemInfo += $"触控:{_touchSupport}";
}
}
TextAppVersionInfo.Text = versionInfo;
TextSystemInfo.Text = systemInfo;
if (CheckDeviceId.IsChecked == true)
{
TextDeviceInfo.Text = $"设备ID: {_deviceId}";
}
else
{
TextDeviceInfo.Text = "设备ID: (不包含)";
}
if (CheckFanceId.IsChecked == true)
{
TextTelemetryInfo.Text = $"遥测ID: {_telemetryId}";
TextTelemetryInfo.Visibility = Visibility.Visible;
}
else
{
TextTelemetryInfo.Text = "遥测ID: (不包含)";
TextTelemetryInfo.Visibility = Visibility.Visible;
}
Page1.Visibility = Visibility.Collapsed;
Page2.Visibility = Visibility.Visible;
ButtonCancel.Visibility = Visibility.Collapsed;
ButtonNext.Visibility = Visibility.Collapsed;
ButtonBack.Visibility = Visibility.Visible;
ButtonSubmit.Visibility = Visibility.Visible;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine($"切换到第二页失败: {ex.Message}");
}
}
private void ButtonSubmit_Click(object sender, RoutedEventArgs e)
{
try
{
string versionInfo = "";
string systemInfo = "";
if (CheckAppVersion.IsChecked == true || CheckUpdateChannel.IsChecked == true)
{
if (CheckAppVersion.IsChecked == true)
{
versionInfo += _appVersion;
}
if (CheckUpdateChannel.IsChecked == true)
{
if (!string.IsNullOrEmpty(versionInfo))
{
versionInfo += " ";
}
versionInfo += $"({_updateChannel})";
}
}
if (CheckOSVersion.IsChecked == true || CheckNetVersion.IsChecked == true || CheckTouchSupport.IsChecked == true)
{
if (CheckOSVersion.IsChecked == true)
{
systemInfo += _osVersion;
}
if (CheckNetVersion.IsChecked == true)
{
if (!string.IsNullOrEmpty(systemInfo))
{
systemInfo += " | ";
}
systemInfo += _netVersion;
}
if (CheckTouchSupport.IsChecked == true)
{
if (!string.IsNullOrEmpty(systemInfo))
{
@@ -178,11 +326,16 @@ namespace Ink_Canvas
url += $"&os={Uri.EscapeDataString(systemInfo)}";
}
if (CheckBoxDeviceId.IsChecked == true)
if (CheckDeviceId.IsChecked == true)
{
url += $"&device={Uri.EscapeDataString(_deviceId)}";
}
if (CheckFanceId.IsChecked == true)
{
url += $"&telemetry={Uri.EscapeDataString(_telemetryId)}";
}
Process.Start(new ProcessStartInfo
{
FileName = url,