Skip to content

Commit b1b27a7

Browse files
committed
Revert
1 parent 6816eeb commit b1b27a7

File tree

3 files changed

+59
-40
lines changed

3 files changed

+59
-40
lines changed

src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
xmlns:ucs="using:Files.App.UserControls.StatusCenter"
2222
xmlns:vm="using:Files.App.ViewModels.UserControls"
2323
x:Name="NavToolbar"
24+
Loading="NavToolbar_Loading"
2425
mc:Ignorable="d">
2526

2627
<UserControl.Resources>
@@ -353,6 +354,7 @@
353354
<controls:OmnibarMode.ContentOnInactive>
354355
<controls:BreadcrumbBar
355356
x:Name="BreadcrumbBar"
357+
ItemClicked="BreadcrumbBar_ItemClicked"
356358
ItemDropDownFlyoutClosed="BreadcrumbBar_ItemDropDownFlyoutClosed"
357359
ItemDropDownFlyoutOpening="BreadcrumbBar_ItemDropDownFlyoutOpening"
358360
ItemsSource="{x:Bind ViewModel.PathComponents, Mode=OneWay}">
@@ -551,7 +553,7 @@
551553
<TeachingTip
552554
x:Name="StatusCenterTeachingTip"
553555
Title="{helpers:ResourceString Name=OngoingTasksTeachingTip/Title}"
554-
IsOpen="{x:Bind OngoingTasksViewModel.ShowStatusCenterTeachingTip, Mode=OneWay}"
556+
IsOpen="False"
555557
Subtitle="{helpers:ResourceString Name=OngoingTasksTeachingTip/Subtitle}"
556558
Target="{x:Bind ShowStatusCenterButton}" />
557559

src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
using Microsoft.UI.Xaml.Input;
1010
using Microsoft.UI.Xaml.Media;
1111
using Microsoft.UI.Xaml.Navigation;
12+
using System.Windows.Input;
1213
using Windows.System;
1314

1415
namespace Files.App.UserControls
@@ -48,7 +49,13 @@ public NavigationToolbar()
4849

4950
// Methods
5051

51-
#region Legacy navigation box impl
52+
private void NavToolbar_Loading(FrameworkElement _, object e)
53+
{
54+
Loading -= NavToolbar_Loading;
55+
if (OngoingTasksViewModel is not null)
56+
OngoingTasksViewModel.NewItemAdded += OngoingTasksActions_ProgressBannerPosted;
57+
}
58+
5259
private void VisiblePath_Loaded(object _, RoutedEventArgs e)
5360
{
5461
// AutoSuggestBox won't receive focus unless it's fully loaded
@@ -123,26 +130,17 @@ private void SearchRegion_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEve
123130
private void VisiblePath_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
124131
=> ViewModel.VisiblePath_QuerySubmitted(sender, args);
125132

126-
private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs args)
127-
{
128-
if (args.InputDevice != FocusInputDeviceKind.Keyboard)
129-
return;
130-
131-
var previousControl = args.OldFocusedElement as FrameworkElement;
132-
if (previousControl?.Name == nameof(HomeButton) || previousControl?.Name == nameof(Refresh))
133-
ViewModel.IsEditModeEnabled = true;
134-
}
135-
#endregion
136-
137-
private async void BreadcrumbBar_ItemDropDownFlyoutOpening(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
133+
private void OngoingTasksActions_ProgressBannerPosted(object? _, StatusCenterItem e)
138134
{
139-
await ViewModel.SetPathBoxDropDownFlyoutAsync(e.Flyout, ViewModel.PathComponents[e.Index]);
140-
}
135+
if (OngoingTasksViewModel is not null)
136+
OngoingTasksViewModel.NewItemAdded -= OngoingTasksActions_ProgressBannerPosted;
141137

142-
private void BreadcrumbBar_ItemDropDownFlyoutClosed(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
143-
{
144-
// Clear the flyout items to save memory
145-
e.Flyout.Items.Clear();
138+
// Displays a teaching tip the first time a banner is posted
139+
if (userSettingsService.AppSettingsService.ShowStatusCenterTeachingTip)
140+
{
141+
StatusCenterTeachingTip.IsOpen = true;
142+
userSettingsService.AppSettingsService.ShowStatusCenterTeachingTip = false;
143+
}
146144
}
147145

148146
private void Button_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEventArgs args)
@@ -203,6 +201,14 @@ private async Task AddHistoryItemsAsync(IEnumerable<PageStackEntry> items, IList
203201
// Start loading the thumbnail in the background
204202
_ = LoadFlyoutItemIconAsync(flyoutItem, args.NavPathParam);
205203

204+
async Task LoadFlyoutItemIconAsync(MenuFlyoutItem flyoutItem, string path)
205+
{
206+
var imageSource = await NavigationHelpers.GetIconForPathAsync(path);
207+
208+
if (imageSource is not null)
209+
flyoutItem.Icon = new ImageIcon() { Source = imageSource };
210+
}
211+
206212
void HistoryItemClicked(ToolbarHistoryItemModel? itemModel)
207213
{
208214
if (itemModel is null)
@@ -235,15 +241,33 @@ void HistoryItemClicked(ToolbarHistoryItemModel? itemModel)
235241
shellPage.Forward_Click();
236242
}
237243
}
244+
}
245+
}
238246

239-
async Task LoadFlyoutItemIconAsync(MenuFlyoutItem flyoutItem, string path)
240-
{
241-
var imageSource = await NavigationHelpers.GetIconForPathAsync(path);
247+
private void ClickablePath_GettingFocus(UIElement sender, GettingFocusEventArgs args)
248+
{
249+
if (args.InputDevice != FocusInputDeviceKind.Keyboard)
250+
return;
242251

243-
if (imageSource is not null)
244-
flyoutItem.Icon = new ImageIcon() { Source = imageSource };
245-
}
246-
}
252+
var previousControl = args.OldFocusedElement as FrameworkElement;
253+
if (previousControl?.Name == nameof(HomeButton) || previousControl?.Name == nameof(Refresh))
254+
ViewModel.IsEditModeEnabled = true;
255+
}
256+
257+
private void BreadcrumbBar_ItemClicked(Controls.BreadcrumbBar sender, Controls.BreadcrumbBarItemClickedEventArgs args)
258+
{
259+
260+
}
261+
262+
private async void BreadcrumbBar_ItemDropDownFlyoutOpening(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
263+
{
264+
await ViewModel.SetPathBoxDropDownFlyoutAsync(e.Flyout, ViewModel.PathComponents[e.Index]);
265+
}
266+
267+
private void BreadcrumbBar_ItemDropDownFlyoutClosed(object sender, Controls.BreadcrumbBarItemDropDownFlyoutEventArgs e)
268+
{
269+
// Clear the flyout items to save memory
270+
e.Flyout.Items.Clear();
247271
}
248272
}
249273
}

src/Files.App/ViewModels/UserControls/StatusCenterViewModel.cs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ namespace Files.App.ViewModels.UserControls
55
{
66
public sealed partial class StatusCenterViewModel : ObservableObject
77
{
8-
private readonly IAppSettingsService AppSettingsService = Ioc.Default.GetRequiredService<IAppSettingsService>();
9-
108
public ObservableCollection<StatusCenterItem> StatusCenterItems { get; } = [];
119

1210
private int _AverageOperationProgressValue = 0;
13-
public int AverageOperationProgressValue { get => _AverageOperationProgressValue; private set => SetProperty(ref _AverageOperationProgressValue, value); }
14-
15-
private bool _ShowStatusCenterTeachingTip;
16-
public bool ShowStatusCenterTeachingTip { get => _ShowStatusCenterTeachingTip; private set => SetProperty(ref _ShowStatusCenterTeachingTip, value); }
11+
public int AverageOperationProgressValue
12+
{
13+
get => _AverageOperationProgressValue;
14+
private set => SetProperty(ref _AverageOperationProgressValue, value);
15+
}
1716

1817
public int InProgressItemCount
1918
{
@@ -90,13 +89,7 @@ public StatusCenterItem AddItem(
9089
cancellationTokenSource);
9190

9291
StatusCenterItems.Insert(0, banner);
93-
94-
// Displays a teaching tip the first time a banner is posted
95-
if (AppSettingsService.ShowStatusCenterTeachingTip)
96-
{
97-
ShowStatusCenterTeachingTip = true;
98-
AppSettingsService.ShowStatusCenterTeachingTip = false;
99-
}
92+
NewItemAdded?.Invoke(this, banner);
10093

10194

10295
NotifyChanges();

0 commit comments

Comments
 (0)