Settings: Generate bug report should tell user there is bug report generating (#40060)

### <!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
### Bug report tool status tracking:

Currently, After clicking the generate package button, button is still
active, as we do not have bug report progress, this will confuse user
whether they actually clicks the button.
Add an enable status to acknowledge the bug generating

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] **Closes:** #xxx
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [x] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

## Detailed Description of the Pull Request / Additional comments
1. Progress bar should be present in generating report place when there
is bug report going on.
2. Runner&Settings should know each other when they trigger the bug
report.
3. Runner tray icon menu item should be disabled when there is one bug
report going on.
4. After bug report generation, everything should be like before.


## Validation Steps Performed


https://github.com/user-attachments/assets/dcbf8e6e-c5e1-4d23-9dab-f16c11ed56cf

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
Kai Tao
2025-06-17 14:49:54 +08:00
committed by GitHub
parent 655398e173
commit 252dbb5853
8 changed files with 229 additions and 11 deletions

View File

@@ -454,11 +454,25 @@
<Button x:Uid="GeneralPage_ViewDiagnosticDataViewerInfoButton" Click="Click_ViewDiagnosticDataViewerRestart" />
</InfoBar.ActionButton>
</InfoBar>
<tkcontrols:SettingsCard x:Uid="GeneralPage_ReportBugPackage" HeaderIcon="{ui:FontIcon Glyph=&#xEBE8;}">
<tkcontrols:SettingsCard
x:Uid="GeneralPage_ReportBugPackage"
HeaderIcon="{ui:FontIcon Glyph=&#xEBE8;}"
Visibility="{x:Bind ViewModel.IsBugReportRunning, Converter={StaticResource ReverseBoolToVisibilityConverter}, Mode=OneWay}">
<Button
x:Uid="GeneralPageReportBugPackage"
HorizontalAlignment="Right"
Click="BugReportToolClicked" />
Click="BugReportToolClicked"
IsEnabled="{x:Bind ViewModel.IsBugReportRunning, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}" />
</tkcontrols:SettingsCard>
<tkcontrols:SettingsCard
x:Uid="GeneralPage_ReportBugPackage"
HeaderIcon="{ui:FontIcon Glyph=&#xEBE8;}"
Visibility="{x:Bind ViewModel.IsBugReportRunning, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}">
<ProgressRing
Width="24"
Height="24"
HorizontalAlignment="Right"
VerticalAlignment="Center" />
</tkcontrols:SettingsCard>
</StackPanel>
</controls:SettingsGroup>

View File

@@ -5,14 +5,15 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Flyout;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.PowerToys.Settings.UI.Library;
using Microsoft.PowerToys.Settings.UI.ViewModels;
using Microsoft.UI.Dispatching;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Windows.Data.Json;
namespace Microsoft.PowerToys.Settings.UI.Views
{
@@ -87,6 +88,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views
ViewModel.InitializeReportBugLink();
// Register IPC handler for bug report status
ShellPage.ShellHandler.IPCResponseHandleList.Add(HandleBugReportStatusResponse); // Register cleanup on unload
this.Unloaded += GeneralPage_Unloaded;
CheckBugReportStatus();
doRefreshBackupRestoreStatus(100);
}
@@ -182,8 +189,48 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private void BugReportToolClicked(object sender, RoutedEventArgs e)
{
// Start bug report
var launchPage = new LaunchPage();
launchPage.ReportBugBtn_Click(sender, e);
ViewModel.IsBugReportRunning = true;
// No need to start timer - the observer pattern will notify us when it finishes
}
private void CheckBugReportStatus()
{
// Send one-time request to check current bug report status
string ipcMessage = "{ \"bug_report_status\": { } }";
ShellPage.SendDefaultIPCMessage(ipcMessage);
}
private void HandleBugReportStatusResponse(JsonObject response)
{
if (response.ContainsKey("bug_report_running"))
{
var isRunning = response.GetNamedBoolean("bug_report_running");
// Update UI on the UI thread
this.DispatcherQueue.TryEnqueue(() =>
{
ViewModel.IsBugReportRunning = isRunning;
});
}
}
private void GeneralPage_Unloaded(object sender, RoutedEventArgs e)
{
CleanupBugReportHandlers();
}
private void CleanupBugReportHandlers()
{
// Remove IPC handler
if (ShellPage.ShellHandler?.IPCResponseHandleList != null)
{
ShellPage.ShellHandler.IPCResponseHandleList.Remove(HandleBugReportStatusResponse);
}
}
}
}

View File

@@ -260,6 +260,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
private bool _isNewVersionDownloading;
private bool _isNewVersionChecked;
private bool _isNoNetwork;
private bool _isBugReportRunning;
private bool _settingsBackupRestoreMessageVisible;
private string _settingsBackupMessage;
@@ -952,6 +953,23 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
}
}
public bool IsBugReportRunning
{
get
{
return _isBugReportRunning;
}
set
{
if (value != _isBugReportRunning)
{
_isBugReportRunning = value;
NotifyPropertyChanged();
}
}
}
public bool SettingsBackupRestoreMessageVisible
{
get