Skip to content

Feature: Auto clear Status Center badge when opening flyout #17153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Files.App/Strings/en-US/Resources.resw
Original file line number Diff line number Diff line change
@@ -4232,4 +4232,8 @@
<data name="ShowStatusCenterButton" xml:space="preserve">
<value>Show status center button</value>
</data>
<data name="StatusCenterProgressRing" xml:space="preserve">
<value>Status center progress ping</value>
<comment>Screen reader name for the status center progress ring</comment>
</data>
</root>
29 changes: 18 additions & 11 deletions src/Files.App/UserControls/NavigationToolbar.xaml
Original file line number Diff line number Diff line change
@@ -29,6 +29,7 @@
<converters:NullToTrueConverter x:Key="NullToFalseConverter" Inverse="True" />
<converters:NullToVisibilityCollapsedConverter x:Key="NullToVisibilityCollapsedConverter" />
<converters1:BoolNegationConverter x:Key="BoolNegationConverter" />
<converters:VisibilityInvertConverter x:Key="VisibilityInvertConverter" />

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///UserControls/KeyboardShortcut/KeyboardShortcut.xaml" />
@@ -474,36 +475,35 @@
Visibility="{x:Bind ViewModel.ShowStatusCenterButton, Mode=OneWay}">

<Grid Margin="-16">

<controls:ThemedIcon
x:Name="StatusCenterIcon"
Width="16"
Height="16"
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItem, Converter={StaticResource BoolNegationConverter}, Mode=OneWay}"
Style="{StaticResource App.ThemedIcons.StatusCenter}" />
Style="{StaticResource App.ThemedIcons.StatusCenter}"
Visibility="{x:Bind OngoingTasksViewModel.ShowProgressRing, Converter={StaticResource VisibilityInvertConverter}, Mode=OneWay}" />

<ProgressRing
x:Name="MedianOperationProgressRing"
HorizontalAlignment="Center"
VerticalAlignment="Center"
x:Load="{x:Bind OngoingTasksViewModel.HasAnyItemInProgress, Mode=OneWay}"
Background="{ThemeResource SubtleFillColorSecondaryBrush}"
AutomationProperties.Name="{helpers:ResourceString Name=StatusCenterProgressRing}"
IsIndeterminate="False"
Visibility="{x:Bind OngoingTasksViewModel.ShowProgressRing, Mode=OneWay}"
Value="{x:Bind OngoingTasksViewModel.AverageOperationProgressValue, Mode=OneWay}" />

<InfoBadge
x:Name="StatusInfoBadge"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Visibility="{x:Bind OngoingTasksViewModel.HasAnyItem, Mode=OneWay}"
Visibility="{x:Bind OngoingTasksViewModel.ShowProgressRing, Mode=OneWay}"
Value="{x:Bind OngoingTasksViewModel.InfoBadgeValue, Mode=OneWay}" />

</Grid>

<Button.Flyout>
<Flyout
contract8Present:ShouldConstrainToRootBounds="False"
AutomationProperties.Name="{helpers:ResourceString Name=StatusCenter}"
Opened="{x:Bind OngoingTasksViewModel.OnStatusCenterFlyoutOpened, Mode=OneWay}"
Placement="BottomEdgeAlignedRight">
<Flyout.FlyoutPresenterStyle>
<Style TargetType="FlyoutPresenter">
@@ -515,7 +515,7 @@
<ucs:StatusCenter
x:Name="OngoingTasksControl"
Width="400"
MinHeight="300"
MinHeight="120"
MaxHeight="500"
x:FieldModifier="public"
IsTabStop="True" />
@@ -627,6 +627,7 @@
To="0" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MedianOperationProgressRing.Background" Value="{ThemeResource SystemFillColorSuccessBrush}" />
<Setter Target="StatusInfoBadge.Style" Value="{StaticResource SuccessIconInfoBadgeStyle}" />
</VisualState.Setters>
</VisualState>
@@ -638,7 +639,9 @@
To="1" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="StatusInfoBadge.Style" Value="{StaticResource AttentionValueInfoBadgeStyle}" />
<Setter Target="MedianOperationProgressRing.Foreground" Value="{ThemeResource SystemFillColorAttentionBrush}" />
<Setter Target="MedianOperationProgressRing.Background" Value="{ThemeResource SubtleFillColorSecondaryBrush}" />
<Setter Target="StatusCenterIcon.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="TasksFailure">
@@ -649,7 +652,9 @@
To="2" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="StatusInfoBadge.Style" Value="{StaticResource CriticalValueInfoBadgeStyle}" />
<Setter Target="MedianOperationProgressRing.Foreground" Value="{ThemeResource SystemFillColorAttentionBrush}" />
<Setter Target="MedianOperationProgressRing.Background" Value="{ThemeResource SubtleFillColorSecondaryBrush}" />
<Setter Target="StatusCenterIcon.Visibility" Value="Collapsed" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="TasksCompletionWithFailure">
@@ -660,11 +665,13 @@
To="3" />
</VisualState.StateTriggers>
<VisualState.Setters>
<Setter Target="MedianOperationProgressRing.Background" Value="{ThemeResource SystemFillColorCriticalBrush}" />
<Setter Target="StatusCenterIcon.Visibility" Value="Collapsed" />
<Setter Target="StatusInfoBadge.Style" Value="{StaticResource CriticalIconInfoBadgeStyle}" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>

</UserControl>
</UserControl>
24 changes: 23 additions & 1 deletion src/Files.App/ViewModels/UserControls/StatusCenterViewModel.cs
Original file line number Diff line number Diff line change
@@ -31,11 +31,28 @@ public int InProgressItemCount
}

public bool HasAnyItemInProgress
=> InProgressItemCount > 0;
{
get
{
if (InProgressItemCount > 0)
ShowProgressRing = true;

return InProgressItemCount > 0;
}
}

public bool HasAnyItem
=> StatusCenterItems.Any();


private bool _ShowProgressRing = false;
public bool ShowProgressRing
{
get => _ShowProgressRing;
private set => SetProperty(ref _ShowProgressRing, value);

}

public int InfoBadgeState
{
get
@@ -64,6 +81,11 @@ public StatusCenterViewModel()
StatusCenterItems.CollectionChanged += (s, e) => OnPropertyChanged(nameof(HasAnyItem));
}

public void OnStatusCenterFlyoutOpened()
{
ShowProgressRing = HasAnyItemInProgress || InfoBadgeState == 3;
}

public StatusCenterItem AddItem(
string headerResource,
string subHeaderResource,

Unchanged files with check annotations Beta

private BladeItem OwnerBladeItem
{
get { return this.Owner as BladeItem; }

Check warning on line 33 in src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs

GitHub Actions / build (Release, x64)

Possible null reference return.

Check warning on line 33 in src/Files.App.Controls/BladeView/BladeItemAutomationPeer.cs

GitHub Actions / build (Debug, arm64)

Possible null reference return.
}
/// <summary>
/// <summary>
/// Initializes a new instance of the <see cref="BladeItem"/> class.
/// </summary>
public BladeItem()

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Release, x64)

Non-nullable field '_parentBladeView' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Release, x64)

Non-nullable field '_closeButton' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Release, arm64)

Non-nullable field '_closeButton' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, x64)

Non-nullable field '_parentBladeView' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, x64)

Non-nullable field '_closeButton' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, arm64)

Non-nullable field '_parentBladeView' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.

Check warning on line 18 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, arm64)

Non-nullable field '_closeButton' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the field as nullable.
{
DefaultStyleKey = typeof(BladeItem);
}
{
base.OnApplyTemplate();
_closeButton = GetTemplateChild("CloseButton") as Button;

Check warning on line 30 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Release, x64)

Possible null reference assignment.

Check warning on line 30 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, x64)

Possible null reference assignment.

Check warning on line 30 in src/Files.App.Controls/BladeView/BladeItem.cs

GitHub Actions / build (Debug, arm64)

Possible null reference assignment.
if (_closeButton == null)
{
SetHasContent( false );
}
UpdateContent( newContent );

Check warning on line 175 in src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs

GitHub Actions / build (Release, x64)

Possible null reference argument for parameter 'newContent' in 'void ToolbarToggleButton.UpdateContent(object newContent)'.

Check warning on line 175 in src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs

GitHub Actions / build (Release, arm64)

Possible null reference argument for parameter 'newContent' in 'void ToolbarToggleButton.UpdateContent(object newContent)'.

Check warning on line 175 in src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs

GitHub Actions / build (Debug, x64)

Possible null reference argument for parameter 'newContent' in 'void ToolbarToggleButton.UpdateContent(object newContent)'.

Check warning on line 175 in src/Files.App.Controls/Toolbar/ToolbarToggleButton/ToolbarToggleButton.cs

GitHub Actions / build (Debug, arm64)

Possible null reference argument for parameter 'newContent' in 'void ToolbarToggleButton.UpdateContent(object newContent)'.
}
#endregion
_ = PInvoke.RoInitialize(RO_INIT_TYPE.RO_INIT_MULTITHREADED);
var classIds = typeof(Program).Assembly.GetTypes()

Check warning on line 28 in src/Files.App.Server/Program.cs

GitHub Actions / build (Release, x64)

Using member 'System.Reflection.Assembly.GetTypes()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types might be removed.

Check warning on line 28 in src/Files.App.Server/Program.cs

GitHub Actions / build (Release, arm64)

Using member 'System.Reflection.Assembly.GetTypes()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. Types might be removed.
.Where(t => t.IsSealed && t.IsPublic && t.IsClass)
.Select(t => t.FullName!)
.Where(name => name.StartsWith("Files.App.Server.", StringComparison.Ordinal))
var newDocument = context.Document.WithSyntaxRoot(newRoot);
context.RegisterCodeFix(
CodeAction.Create(

Check warning on line 57 in src/Files.Core.SourceGenerator/CodeFixProviders/StringsPropertyCodeFixProvider.cs

GitHub Actions / build (Release, x64)

Provide an explicit argument for optional parameter 'equivalenceKey', which is non-null and unique for each kind of code action created by this fixer

Check warning on line 57 in src/Files.Core.SourceGenerator/CodeFixProviders/StringsPropertyCodeFixProvider.cs

GitHub Actions / build (Release, arm64)

Provide an explicit argument for optional parameter 'equivalenceKey', which is non-null and unique for each kind of code action created by this fixer

Check warning on line 57 in src/Files.Core.SourceGenerator/CodeFixProviders/StringsPropertyCodeFixProvider.cs

GitHub Actions / build (Debug, x64)

Provide an explicit argument for optional parameter 'equivalenceKey', which is non-null and unique for each kind of code action created by this fixer

Check warning on line 57 in src/Files.Core.SourceGenerator/CodeFixProviders/StringsPropertyCodeFixProvider.cs

GitHub Actions / build (Debug, arm64)

Provide an explicit argument for optional parameter 'equivalenceKey', which is non-null and unique for each kind of code action created by this fixer
CodeFixProviderTitle,
c => Task.FromResult(newDocument),
null),
/// <summary>
/// Analyzer that detects if string literals can be replaced with constants from the <c>Strings</c> class.
/// </summary>
[DiagnosticAnalyzer(LanguageNames.CSharp)]

Check warning on line 12 in src/Files.Core.SourceGenerator/Analyzers/StringsPropertyAnalyzer.cs

GitHub Actions / build (Release, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 12 in src/Files.Core.SourceGenerator/Analyzers/StringsPropertyAnalyzer.cs

GitHub Actions / build (Release, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 12 in src/Files.Core.SourceGenerator/Analyzers/StringsPropertyAnalyzer.cs

GitHub Actions / build (Debug, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 12 in src/Files.Core.SourceGenerator/Analyzers/StringsPropertyAnalyzer.cs

GitHub Actions / build (Debug, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)
internal sealed class StringsPropertyAnalyzer : DiagnosticAnalyzer
{
/// <summary>
/// <summary>
/// Generates properties for strings based on resource files.
/// </summary>
[Generator]

Check warning on line 13 in src/Files.Core.SourceGenerator/Generators/StringsPropertyGenerator.cs

GitHub Actions / build (Release, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 13 in src/Files.Core.SourceGenerator/Generators/StringsPropertyGenerator.cs

GitHub Actions / build (Release, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 13 in src/Files.Core.SourceGenerator/Generators/StringsPropertyGenerator.cs

GitHub Actions / build (Debug, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 13 in src/Files.Core.SourceGenerator/Generators/StringsPropertyGenerator.cs

GitHub Actions / build (Debug, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)
internal sealed class StringsPropertyGenerator : IIncrementalGenerator
{
// Static HashSet to track generated file names
/// <summary>
/// A generator for serializing/deserializing objects to/from the Windows Registry using attributes.
/// </summary>
[Generator]

Check warning on line 9 in src/Files.Core.SourceGenerator/Generators/RegistrySerializationGenerator.cs

GitHub Actions / build (Release, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 9 in src/Files.Core.SourceGenerator/Generators/RegistrySerializationGenerator.cs

GitHub Actions / build (Release, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 9 in src/Files.Core.SourceGenerator/Generators/RegistrySerializationGenerator.cs

GitHub Actions / build (Debug, x64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)

Check warning on line 9 in src/Files.Core.SourceGenerator/Generators/RegistrySerializationGenerator.cs

GitHub Actions / build (Debug, arm64)

This compiler extension should not be implemented in an assembly containing a reference to Microsoft.CodeAnalysis.Workspaces. The Microsoft.CodeAnalysis.Workspaces assembly is not provided during command line compilation scenarios, so references to it could cause the compiler extension to behave unpredictably. (https://github.com/dotnet/roslyn-analyzers/blob/main/docs/rules/RS1038.md)
internal sealed class RegistrySerializationGenerator : IIncrementalGenerator
{
/// <summary>
private static void OnOneRowModeEnabledChanged(DependencyObject d, object newValue)
{
var self = d as AdaptiveGridView;
self.DetermineOneRowMode();

Check warning on line 65 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

GitHub Actions / build (Release, arm64)

Dereference of a possibly null reference.

Check warning on line 65 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

GitHub Actions / build (Debug, x64)

Dereference of a possibly null reference.
}
private static void DesiredWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = d as AdaptiveGridView;
self.RecalculateLayout(self.ActualWidth);

Check warning on line 71 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

GitHub Actions / build (Release, arm64)

Dereference of a possibly null reference.

Check warning on line 71 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

GitHub Actions / build (Debug, x64)

Dereference of a possibly null reference.
}
private static void OnStretchContentForSingleRowPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var self = d as AdaptiveGridView;
self.RecalculateLayout(self.ActualWidth);

Check warning on line 77 in src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

GitHub Actions / build (Release, arm64)

Dereference of a possibly null reference.
}
/// <summary>
get
{
this._parentBladeView.TryGetTarget(out var bladeView);
return bladeView;

Check warning on line 82 in src/Files.App.Controls/BladeView/BladeItem.Properties.cs

GitHub Actions / build (Debug, arm64)

Possible null reference return.
}
set => this._parentBladeView = new WeakReference<BladeView>(value);
}