|
6 | 6 | using Files.App.UserControls.MultitaskingControl;
|
7 | 7 | using Files.App.Views;
|
8 | 8 | using Files.Backend.Services;
|
| 9 | +using Microsoft.UI.Xaml.Controls; |
9 | 10 | using Microsoft.UI.Xaml.Input;
|
| 11 | +using Microsoft.UI.Xaml.Media.Imaging; |
10 | 12 | using Microsoft.UI.Xaml.Navigation;
|
11 | 13 | using System.Windows.Input;
|
12 | 14 | using Windows.System;
|
@@ -187,16 +189,16 @@ public async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
|
187 | 189 | }
|
188 | 190 | }
|
189 | 191 |
|
190 |
| - public async Task<(string tabLocationHeader, Microsoft.UI.Xaml.Controls.IconSource tabIcon, string toolTipText)> GetSelectedTabInfoAsync(string currentPath) |
| 192 | + public async Task<(string tabLocationHeader, IconSource tabIcon, string toolTipText)> GetSelectedTabInfoAsync(string currentPath) |
191 | 193 | {
|
192 | 194 | string? tabLocationHeader;
|
193 |
| - var iconSource = new Microsoft.UI.Xaml.Controls.ImageIconSource(); |
| 195 | + var iconSource = new ImageIconSource(); |
194 | 196 | string toolTipText = currentPath;
|
195 | 197 |
|
196 | 198 | if (string.IsNullOrEmpty(currentPath) || currentPath == "Home")
|
197 | 199 | {
|
198 | 200 | tabLocationHeader = "Home".GetLocalizedResource();
|
199 |
| - iconSource.ImageSource = new Microsoft.UI.Xaml.Media.Imaging.BitmapImage(new Uri(Constants.FluentIconsPaths.HomeIcon)); |
| 201 | + iconSource.ImageSource = new BitmapImage(new Uri(Constants.FluentIconsPaths.HomeIcon)); |
200 | 202 | }
|
201 | 203 | else if (currentPath.Equals(Constants.UserEnvironmentPaths.DesktopPath, StringComparison.OrdinalIgnoreCase))
|
202 | 204 | {
|
@@ -224,12 +226,18 @@ public async Task UpdateTabInfo(TabItem tabItem, object navigationArg)
|
224 | 226 | // If localized string is empty use the library name.
|
225 | 227 | tabLocationHeader = string.IsNullOrEmpty(libName) ? library.Text : libName;
|
226 | 228 | }
|
| 229 | + else if (App.WSLDistroManager.TryGetDistro(currentPath, out WslDistroItem? wslDistro) && currentPath.Equals(wslDistro.Path)) |
| 230 | + { |
| 231 | + tabLocationHeader = wslDistro.Text; |
| 232 | + iconSource.ImageSource = new BitmapImage(wslDistro.Logo); |
| 233 | + } |
227 | 234 | else
|
228 | 235 | {
|
229 | 236 | var normalizedCurrentPath = PathNormalization.NormalizePath(currentPath);
|
230 | 237 | var matchingCloudDrive = App.CloudDrivesManager.Drives.FirstOrDefault(x => normalizedCurrentPath.Equals(PathNormalization.NormalizePath(x.Path), StringComparison.OrdinalIgnoreCase));
|
231 | 238 | if (matchingCloudDrive is not null)
|
232 | 239 | {
|
| 240 | + iconSource.ImageSource = matchingCloudDrive.Icon; |
233 | 241 | tabLocationHeader = matchingCloudDrive.Text;
|
234 | 242 | }
|
235 | 243 | else if (PathNormalization.NormalizePath(PathNormalization.GetPathRoot(currentPath)) == normalizedCurrentPath) // If path is a drive's root
|
|
0 commit comments