Skip to content

Commit aa5ef84

Browse files
Hide SPC, the feature needs stabilization
1 parent 392f987 commit aa5ef84

File tree

6 files changed

+39
-8
lines changed

6 files changed

+39
-8
lines changed

CHANGELOG.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Breaking changes:
66
New features:
77
* It is now possible to show packages in a specific folder (83b31861, e5c64e05, 8639ab33)
88
* PSF analyzer now supports [MSIX Helper](https://techcommunity.microsoft.com/discussions/msix-discussions/msix-helper/3935229) (dbad0b95)
9-
* A new screen for managing Shared Package Containers (c2986972)
109

1110
Improvements:
1211
* Support for human-friendly display of Windows 11 versions 22H2, 23H2, and 24H2 (5fc1ce2f)

src/Otor.MsixHero.App/Hero/Handlers/GetSharedPackageContainersHandler.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,24 @@
2424
using Otor.MsixHero.App.Mvvm.Progress;
2525
using Otor.MsixHero.Appx.Packaging.SharedPackageContainer;
2626
using Otor.MsixHero.Appx.Packaging.SharedPackageContainer.Entities;
27+
using Otor.MsixHero.Elevation;
2728

2829
namespace Otor.MsixHero.App.Hero.Handlers;
2930

3031
public class GetSharedPackageContainersHandler : IRequestHandler<GetSharedPackageContainersCommand, IList<SharedPackageContainer>>
3132
{
33+
private readonly IUacElevation _uacElevation;
3234
private readonly IAppxSharedPackageContainerService _containerService;
3335
private readonly IMsixHeroCommandExecutor _commandExecutor;
3436
private readonly IBusyManager _busyManager;
3537

3638
public GetSharedPackageContainersHandler(
39+
IUacElevation uacElevation,
3740
IMsixHeroCommandExecutor commandExecutor,
3841
IBusyManager busyManager,
3942
IAppxSharedPackageContainerService containerService)
4043
{
44+
_uacElevation = uacElevation;
4145
this._containerService = containerService;
4246
this._commandExecutor = commandExecutor;
4347
this._busyManager = busyManager;

src/Otor.MsixHero.App/Modules/Containers/Commands/ContainersCommandHandler.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ private async void OnDelete()
107107
}
108108
catch (Exception e)
109109
{
110-
this._interactionService.ShowError("The container could not be reset. " + e.GetBaseException().Message);
110+
this._interactionService.ShowError("The container could not be deleted. " + e.GetBaseException().Message);
111111
return;
112112
}
113113
finally

src/Otor.MsixHero.App/Modules/Dialogs/Settings/View/SettingsView.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
SelectedValuePath="Tag"
205205
SelectedValue="{Binding DefaultScreen.CurrentValue}">
206206
<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.Packages}" Content="{localization:Loc Dialogs_Settings_InitialScreen_Packages}" />
207-
<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.Containers}" Content="{localization:Loc Dialogs_Settings_InitialScreen_Containers}" />
207+
<!--<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.Containers}" Content="{localization:Loc Dialogs_Settings_InitialScreen_Containers}" />-->
208208
<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.Volumes}" Content="{localization:Loc Dialogs_Settings_InitialScreen_Volumes}" />
209209
<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.Events}" Content="{localization:Loc Dialogs_Settings_InitialScreen_EventViewer}" />
210210
<ComboBoxItem Tag="{x:Static configuration:DefaultScreen.System}" Content="{localization:Loc Dialogs_Settings_InitialScreen_SystemState}" />

src/Otor.MsixHero.App/Modules/Main/Sidebar/ViewModels/SidebarViewModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ public SidebarViewModel(
6666
NavigationPaths.PackageManagement,
6767
TabPackages),
6868

69-
new SidebarItemViewModel(
69+
/*new SidebarItemViewModel(
7070
ApplicationMode.Containers,
7171
NavigationPaths.Containers,
72-
TabContainer),
72+
TabContainer),*/
7373

7474
new SidebarItemViewModel(
7575
ApplicationMode.VolumeManager,

src/Otor.MsixHero.Appx/Packaging/SharedPackageContainer/AppxSharedPackageContainerService.cs

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,53 @@
2727
using Otor.MsixHero.Appx.Packaging.SharedPackageContainer.Entities;
2828
using Otor.MsixHero.Appx.Packaging.SharedPackageContainer.Exceptions;
2929
using Otor.MsixHero.Infrastructure.Helpers;
30+
using Otor.MsixHero.Infrastructure.ThirdParty.PowerShell;
3031

3132
namespace Otor.MsixHero.Appx.Packaging.SharedPackageContainer;
3233

3334
public class AppxSharedPackageContainerService : IAppxSharedPackageContainerService
3435
{
36+
public AppxSharedPackageContainerService()
37+
{
38+
}
39+
3540
private Lazy<SharedPackageContainerManager> _manager = new(SharedPackageContainerManager.GetDefault);
3641

37-
public Task<IList<Entities.SharedPackageContainer>> GetAll(CancellationToken cancellationToken = default)
42+
public async Task<IList<Entities.SharedPackageContainer>> GetAll(CancellationToken cancellationToken = default)
3843
{
39-
var containers = this._manager.Value.FindContainers(new FindSharedPackageContainerOptions());
44+
// Note: Some issues with SharedPackageContainerManager, let's revert to PowerShell
45+
var pss = await PowerShellSession.CreateForAppxModule().ConfigureAwait(false);
46+
pss.AddCommand("Get-AppSharedPackageContainer");
47+
var powerShellResult = await pss.InvokeAsync().ConfigureAwait(false);
4048

4149
IList<Entities.SharedPackageContainer> list = new List<Entities.SharedPackageContainer>();
50+
foreach (var item in powerShellResult)
51+
{
52+
var propName = item.Properties.FirstOrDefault(p => p.Name == "Name")?.Value as string;
53+
var propId = item.Properties.FirstOrDefault(p => p.Name == "Id")?.Value as string;
54+
var propPackageFamilies = item.Properties.FirstOrDefault(p => p.Name == "PackageFamilyNames")?.Value as IList<string> ?? Array.Empty<string>();
55+
56+
var spc = new Entities.SharedPackageContainer()
57+
{
58+
Id = propId,
59+
Name = propName,
60+
PackageFamilies = propPackageFamilies.Select(pfn => new SharedPackageFamily { FamilyName = pfn }).ToList()
61+
};
62+
63+
list.Add(spc);
64+
}
65+
66+
return list;
67+
68+
var containers = this._manager.Value.FindContainers(new FindSharedPackageContainerOptions());
69+
4270
foreach (var result in containers)
4371
{
4472

4573
list.Add(SourceToSharedContainer(result));
4674
}
4775

48-
return Task.FromResult(list);
76+
return list;
4977
}
5078

5179
public async Task<Entities.SharedPackageContainer> Add(

0 commit comments

Comments
 (0)