Skip to content

Commit 2ea3dfe

Browse files
authored
Code Quality: Renamed AddressToolbar and InnerNavigationToolbaar (#16927)
1 parent 26a1f7d commit 2ea3dfe

File tree

12 files changed

+38
-60
lines changed

12 files changed

+38
-60
lines changed

src/Files.App.Controls/BladeView/BladeView.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@
125125
FontSize="14"
126126
Foreground="{TemplateBinding CloseButtonForeground}"
127127
Style="{StaticResource ButtonRevealStyle}"
128-
Visibility="{TemplateBinding CloseButtonVisibility}"
129-
TabIndex="0" />
128+
TabIndex="0"
129+
Visibility="{TemplateBinding CloseButtonVisibility}" />
130130
</Grid>
131131
</ControlTemplate>
132132
</Setter.Value>

src/Files.App/Data/Contexts/ContentPage/ContentPageContext.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,15 @@ private void ToolbarViewModel_PropertyChanged(object? sender, PropertyChangedEve
160160
{
161161
switch (e.PropertyName)
162162
{
163-
case nameof(AddressToolbarViewModel.CanGoBack):
164-
case nameof(AddressToolbarViewModel.CanGoForward):
165-
case nameof(AddressToolbarViewModel.CanNavigateToParent):
166-
case nameof(AddressToolbarViewModel.HasItem):
167-
case nameof(AddressToolbarViewModel.CanRefresh):
168-
case nameof(AddressToolbarViewModel.IsSearchBoxVisible):
163+
case nameof(NavigationToolbarViewModel.CanGoBack):
164+
case nameof(NavigationToolbarViewModel.CanGoForward):
165+
case nameof(NavigationToolbarViewModel.CanNavigateToParent):
166+
case nameof(NavigationToolbarViewModel.HasItem):
167+
case nameof(NavigationToolbarViewModel.CanRefresh):
168+
case nameof(NavigationToolbarViewModel.IsSearchBoxVisible):
169169
OnPropertyChanged(e.PropertyName);
170170
break;
171-
case nameof(AddressToolbarViewModel.SelectedItems):
171+
case nameof(NavigationToolbarViewModel.SelectedItems):
172172
UpdateSelectedItems();
173173
break;
174174
}

src/Files.App/Data/Contracts/IShellPage.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public interface IShellPage : ITabBarItemContent, IMultiPaneInfo, IDisposable, I
2323

2424
IFilesystemHelpers FilesystemHelpers { get; }
2525

26-
AddressToolbarViewModel ToolbarViewModel { get; }
26+
NavigationToolbarViewModel ToolbarViewModel { get; }
2727

2828
bool CanNavigateBackward { get; }
2929

src/Files.App/UserControls/AddressToolbar.xaml renamed to src/Files.App/UserControls/NavigationToolbar.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Copyright (c) Files Community. Licensed under the MIT License. -->
22
<UserControl
3-
x:Class="Files.App.UserControls.AddressToolbar"
3+
x:Class="Files.App.UserControls.NavigationToolbar"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"

src/Files.App/UserControls/AddressToolbar.xaml.cs renamed to src/Files.App/UserControls/NavigationToolbar.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
namespace Files.App.UserControls
1717
{
18-
public sealed partial class AddressToolbar : UserControl
18+
public sealed partial class NavigationToolbar : UserControl
1919
{
2020
// Dependency injections
2121

@@ -39,15 +39,15 @@ public sealed partial class AddressToolbar : UserControl
3939
public partial bool ShowSearchBox { get; set; }
4040

4141
[GeneratedDependencyProperty]
42-
public partial AddressToolbarViewModel ViewModel { get; set; }
42+
public partial NavigationToolbarViewModel ViewModel { get; set; }
4343

4444
// Commands
4545

4646
private readonly ICommand historyItemClickedCommand;
4747

4848
// Constructor
4949

50-
public AddressToolbar()
50+
public NavigationToolbar()
5151
{
5252
InitializeComponent();
5353

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace Files.App.UserControls
1111
public sealed partial class PathBreadcrumb : UserControl
1212
{
1313
[GeneratedDependencyProperty]
14-
public partial AddressToolbarViewModel ViewModel { get; set; }
14+
public partial NavigationToolbarViewModel ViewModel { get; set; }
1515

1616
public PathBreadcrumb()
1717
{

src/Files.App/UserControls/InnerNavigationToolbar.xaml renamed to src/Files.App/UserControls/Toolbar.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- Copyright (c) Files Community. Licensed under the MIT License. -->
22
<UserControl
3-
x:Class="Files.App.UserControls.InnerNavigationToolbar"
3+
x:Class="Files.App.UserControls.Toolbar"
44
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
55
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
66
xmlns:contract8Present="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract,8)"

src/Files.App/UserControls/InnerNavigationToolbar.xaml.cs renamed to src/Files.App/UserControls/Toolbar.xaml.cs

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4+
using CommunityToolkit.WinUI;
45
using Microsoft.UI.Xaml;
56
using Microsoft.UI.Xaml.Controls;
67
using Microsoft.UI.Xaml.Input;
@@ -10,50 +11,27 @@
1011

1112
namespace Files.App.UserControls
1213
{
13-
public sealed partial class InnerNavigationToolbar : UserControl
14+
public sealed partial class Toolbar : UserControl
1415
{
15-
public InnerNavigationToolbar()
16-
{
17-
InitializeComponent();
18-
}
19-
20-
public IUserSettingsService UserSettingsService { get; } = Ioc.Default.GetRequiredService<IUserSettingsService>();
21-
public ICommandManager Commands { get; } = Ioc.Default.GetRequiredService<ICommandManager>();
22-
public IModifiableCommandManager ModifiableCommands { get; } = Ioc.Default.GetRequiredService<IModifiableCommandManager>();
23-
16+
private readonly IUserSettingsService UserSettingsService = Ioc.Default.GetRequiredService<IUserSettingsService>();
17+
private readonly ICommandManager Commands = Ioc.Default.GetRequiredService<ICommandManager>();
18+
private readonly IModifiableCommandManager ModifiableCommands = Ioc.Default.GetRequiredService<IModifiableCommandManager>();
2419
private readonly IAddItemService addItemService = Ioc.Default.GetRequiredService<IAddItemService>();
2520

26-
public AppModel AppModel => App.AppModel;
27-
28-
public AddressToolbarViewModel? ViewModel
29-
{
30-
get => (AddressToolbarViewModel)GetValue(ViewModelProperty);
31-
set => SetValue(ViewModelProperty, value);
32-
}
33-
34-
// Using a DependencyProperty as the backing store for ViewModel. This enables animation, styling, binding, etc...
35-
public static readonly DependencyProperty ViewModelProperty =
36-
DependencyProperty.Register(nameof(ViewModel), typeof(AddressToolbarViewModel), typeof(InnerNavigationToolbar), new PropertyMetadata(null));
21+
[GeneratedDependencyProperty]
22+
public partial NavigationToolbarViewModel? ViewModel { get; set; }
3723

38-
public bool ShowViewControlButton
39-
{
40-
get { return (bool)GetValue(ShowViewControlButtonProperty); }
41-
set { SetValue(ShowViewControlButtonProperty, value); }
42-
}
24+
[GeneratedDependencyProperty]
25+
public partial bool ShowViewControlButton { get; set; }
4326

44-
// Using a DependencyProperty as the backing store for ShowViewControlButton. This enables animation, styling, binding, etc...
45-
public static readonly DependencyProperty ShowViewControlButtonProperty =
46-
DependencyProperty.Register("ShowViewControlButton", typeof(bool), typeof(AddressToolbar), new PropertyMetadata(null));
27+
[GeneratedDependencyProperty]
28+
public partial bool ShowPreviewPaneButton { get; set; }
4729

48-
public bool ShowPreviewPaneButton
30+
public Toolbar()
4931
{
50-
get { return (bool)GetValue(ShowPreviewPaneButtonProperty); }
51-
set { SetValue(ShowPreviewPaneButtonProperty, value); }
32+
InitializeComponent();
5233
}
5334

54-
// Using a DependencyProperty as the backing store for ShowPreviewPaneButton. This enables animation, styling, binding, etc...
55-
public static readonly DependencyProperty ShowPreviewPaneButtonProperty =
56-
DependencyProperty.Register("ShowPreviewPaneButton", typeof(bool), typeof(AddressToolbar), new PropertyMetadata(null));
5735
private void NewEmptySpace_Opening(object sender, object e)
5836
{
5937
var shell = NewEmptySpace.Items.Where(x => (x.Tag as string) == "CreateNewFile").Reverse().ToList();
@@ -131,4 +109,4 @@ private void AppBarButton_AccessKeyInvoked(UIElement sender, AccessKeyInvokedEve
131109
args.Handled = true;
132110
}
133111
}
134-
}
112+
}

src/Files.App/ViewModels/UserControls/AddressToolbarViewModel.cs renamed to src/Files.App/ViewModels/UserControls/NavigationToolbarViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace Files.App.ViewModels.UserControls
1818
{
19-
public sealed partial class AddressToolbarViewModel : ObservableObject, IAddressToolbarViewModel, IDisposable
19+
public sealed partial class NavigationToolbarViewModel : ObservableObject, IAddressToolbarViewModel, IDisposable
2020
{
2121
private const int MAX_SUGGESTIONS = 10;
2222

@@ -197,7 +197,7 @@ public Style LayoutThemedIcon
197197

198198
private PointerRoutedEventArgs? pointerRoutedEventArgs;
199199

200-
public AddressToolbarViewModel()
200+
public NavigationToolbarViewModel()
201201
{
202202
dispatcherQueue = DispatcherQueue.GetForCurrentThread();
203203
dragOverTimer = dispatcherQueue.CreateTimer();
@@ -578,7 +578,7 @@ public void UpdateAdditionalActions()
578578
OnPropertyChanged(nameof(HasAdditionalAction));
579579
}
580580

581-
private AddressToolbar? AddressToolbar => (MainWindow.Instance.Content as Frame)?.FindDescendant<AddressToolbar>();
581+
private NavigationToolbar? AddressToolbar => (MainWindow.Instance.Content as Frame)?.FindDescendant<NavigationToolbar>();
582582

583583
private void CloseSearchBox(bool doFocus = false)
584584
{

src/Files.App/Views/Layouts/BaseLayoutPage.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ public abstract class BaseLayoutPage : Page, IBaseLayoutPage, INotifyPropertyCha
7676

7777
// Properties
7878

79-
protected AddressToolbar? NavToolbar
80-
=> (MainWindow.Instance.Content as Frame)?.FindDescendant<AddressToolbar>();
79+
protected NavigationToolbar? NavToolbar
80+
=> (MainWindow.Instance.Content as Frame)?.FindDescendant<NavigationToolbar>();
8181

8282
public LayoutPreferencesManager? FolderSettings
8383
=> ParentShellPageInstance?.InstanceViewModel.FolderSettings;

0 commit comments

Comments
 (0)