Skip to content

Commit

Permalink
Add pin app to taskbar support
Browse files Browse the repository at this point in the history
Add pin app to taskbar support
  • Loading branch information
Gaoyifei1011 committed Jun 13, 2023
1 parent 8d5be5f commit b872527
Show file tree
Hide file tree
Showing 12 changed files with 188 additions and 51 deletions.
6 changes: 3 additions & 3 deletions GetStoreApp/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
// 程序集信息设置
[assembly: AssemblyCopyright("Copyright ©2022-2023 高怡飞, All Rights Reserved.")]
[assembly: AssemblyDescription("获取商店应用 桌面程序")]
[assembly: AssemblyFileVersion("2.0.611.0")]
[assembly: AssemblyInformationalVersion("2.0.611.0")]
[assembly: AssemblyFileVersion("2.0.613.0")]
[assembly: AssemblyInformationalVersion("2.0.613.0")]
[assembly: AssemblyProduct("获取商店应用 桌面程序")]
[assembly: AssemblyTitle("获取商店应用")]
[assembly: AssemblyVersion("2.0.611.0")]
[assembly: AssemblyVersion("2.0.613.0")]

// 设置程序集对COM组件的访问权限
[assembly: ComVisible(false)]
Expand Down
58 changes: 29 additions & 29 deletions GetStoreApp/Services/Root/WinGetService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static class WinGetService
private static readonly Guid CLSID_CreateCompositePackageCatalogOptions_Dev = new Guid("EE160901-B317-4EA7-9CC6-5355C6D7D8A7");

// COM接口:IUnknown 接口
private static readonly Guid IID = new Guid("00000000-0000-0000-C000-000000000046");
private static readonly Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");

private static bool actuallyUseDev = false;

Expand All @@ -42,14 +42,14 @@ public static class WinGetService
/// </summary>
public static unsafe void InitializeService()
{
fixed (Guid* CLSID_PackageManager_Ptr = &CLSID_PackageManager, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageManager_Ptr = &CLSID_PackageManager, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageManager_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageManager_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
IsOfficialVersionExisted = obj != IntPtr.Zero;
}
fixed (Guid* CLSID_PackageManager_Dev_Ptr = &CLSID_PackageManager_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageManager_Dev_Ptr = &CLSID_PackageManager_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageManager_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageManager_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
IsDevVersionExisted = obj != IntPtr.Zero;
}

Expand All @@ -66,17 +66,17 @@ public static unsafe PackageManager CreatePackageManager()
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_PackageManager_Dev_Ptr = &CLSID_PackageManager_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageManager_Dev_Ptr = &CLSID_PackageManager_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageManager_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageManager_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return PackageManager.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_PackageManager_Ptr = &CLSID_PackageManager, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageManager_Ptr = &CLSID_PackageManager, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageManager_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageManager_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return PackageManager.FromAbi(obj);
}
}
Expand All @@ -89,17 +89,17 @@ public static unsafe InstallOptions CreateInstallOptions()
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_InstallOptions_Dev_Ptr = &CLSID_InstallOptions_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_InstallOptions_Dev_Ptr = &CLSID_InstallOptions_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_InstallOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_InstallOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return InstallOptions.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_InstallOptions_Ptr = &CLSID_InstallOptions, IID_Ptr = &IID)
fixed (Guid* CLSID_InstallOptions_Ptr = &CLSID_InstallOptions, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_InstallOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_InstallOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return InstallOptions.FromAbi(obj);
}
}
Expand All @@ -112,17 +112,17 @@ public static unsafe UninstallOptions CreateUninstallOptions()
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_UnInstallOptions_Dev_Ptr = &CLSID_UnInstallOptions_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_UnInstallOptions_Dev_Ptr = &CLSID_UnInstallOptions_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_UnInstallOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_UnInstallOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return UninstallOptions.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_UnInstallOptions_Ptr = &CLSID_UnInstallOptions, IID_Ptr = &IID)
fixed (Guid* CLSID_UnInstallOptions_Ptr = &CLSID_UnInstallOptions, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_UnInstallOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_UnInstallOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return UninstallOptions.FromAbi(obj);
}
}
Expand All @@ -135,17 +135,17 @@ public static unsafe FindPackagesOptions CreateFindPackagesOptions()
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_FindPackagesOptions_Dev_Ptr = &CLSID_FindPackagesOptions_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_FindPackagesOptions_Dev_Ptr = &CLSID_FindPackagesOptions_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_FindPackagesOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_FindPackagesOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return FindPackagesOptions.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_FindPackagesOptions_Ptr = &CLSID_FindPackagesOptions, IID_Ptr = &IID)
fixed (Guid* CLSID_FindPackagesOptions_Ptr = &CLSID_FindPackagesOptions, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_FindPackagesOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_FindPackagesOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return FindPackagesOptions.FromAbi(obj);
}
}
Expand All @@ -158,17 +158,17 @@ public static unsafe CreateCompositePackageCatalogOptions CreateCreateCompositeP
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_CreateCompositePackageCatalogOptions_Dev_Ptr = &CLSID_CreateCompositePackageCatalogOptions_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_CreateCompositePackageCatalogOptions_Dev_Ptr = &CLSID_CreateCompositePackageCatalogOptions_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_CreateCompositePackageCatalogOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_CreateCompositePackageCatalogOptions_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return CreateCompositePackageCatalogOptions.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_CreateCompositePackageCatalogOptions_Ptr = &CLSID_CreateCompositePackageCatalogOptions, IID_Ptr = &IID)
fixed (Guid* CLSID_CreateCompositePackageCatalogOptions_Ptr = &CLSID_CreateCompositePackageCatalogOptions, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_CreateCompositePackageCatalogOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_CreateCompositePackageCatalogOptions_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return CreateCompositePackageCatalogOptions.FromAbi(obj);
}
}
Expand All @@ -181,17 +181,17 @@ public static unsafe PackageMatchFilter CreatePacakgeMatchFilter()
{
if (actuallyUseDev)
{
fixed (Guid* CLSID_PackageMatchFilter_Dev_Ptr = &CLSID_PackageMatchFilter_Dev, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageMatchFilter_Dev_Ptr = &CLSID_PackageMatchFilter_Dev, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageMatchFilter_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageMatchFilter_Dev_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return PackageMatchFilter.FromAbi(obj);
}
}
else
{
fixed (Guid* CLSID_PackageMatchFilter_Ptr = &CLSID_PackageMatchFilter, IID_Ptr = &IID)
fixed (Guid* CLSID_PackageMatchFilter_Ptr = &CLSID_PackageMatchFilter, IID_IUnknown_Ptr = &IID_IUnknown)
{
Ole32Library.CoCreateInstance(CLSID_PackageMatchFilter_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_Ptr, out IntPtr obj);
Ole32Library.CoCreateInstance(CLSID_PackageMatchFilter_Ptr, IntPtr.Zero, CLSCTX.CLSCTX_ALL, IID_IUnknown_Ptr, out IntPtr obj);
return PackageMatchFilter.FromAbi(obj);
}
}
Expand Down
1 change: 1 addition & 0 deletions GetStoreApp/UI/Controls/Download/CompletedControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>

<MenuFlyoutItem
Command="{Binding ElementName=CompletedRoot, Path=DataContext.FileInformationCommand, Mode=OneTime}"
CommandParameter="{Binding}"
Expand Down
11 changes: 9 additions & 2 deletions GetStoreApp/UI/Controls/WinGet/InstalledAppsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/UnInstall')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.PrimaryButtonToolTip>

<basicInput:ExtendedSplitButton.SecondaryButtonToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/ViewMoreOptions')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.SecondaryButtonToolTip>

<basicInput:ExtendedSplitButton.Flyout>
Expand All @@ -305,6 +305,13 @@
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE8C8;" Style="{StaticResource SegoeFluentStyle}" />
</MenuFlyoutItem.Icon>

<ToolTipService.ToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/CopyUnInstallText')}"
Placement="Bottom"
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>
</menusAndToolbars:AdaptiveMenuFlyout>
</basicInput:ExtendedSplitButton.Flyout>
Expand Down
18 changes: 16 additions & 2 deletions GetStoreApp/UI/Controls/WinGet/SearchAppsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,14 +298,14 @@
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/Install')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.PrimaryButtonToolTip>

<basicInput:ExtendedSplitButton.SecondaryButtonToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/ViewMoreOptions')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.SecondaryButtonToolTip>

<basicInput:ExtendedSplitButton.Flyout>
Expand All @@ -318,6 +318,13 @@
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE8C8;" Style="{StaticResource SegoeFluentStyle}" />
</MenuFlyoutItem.Icon>

<ToolTipService.ToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/CopyInstallText')}"
Placement="Bottom"
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>

<MenuFlyoutItem
Expand All @@ -328,6 +335,13 @@
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE74B;" Style="{StaticResource SegoeFluentStyle}" />
</MenuFlyoutItem.Icon>

<ToolTipService.ToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/InstallWithCmd')}"
Placement="Bottom"
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>
</menusAndToolbars:AdaptiveMenuFlyout>
</basicInput:ExtendedSplitButton.Flyout>
Expand Down
20 changes: 17 additions & 3 deletions GetStoreApp/UI/Controls/WinGet/UpgradableAppsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
Grid.Column="3"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Foreground="{StaticResource HyperlinkButtonForeground}"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
HorizontalTextAlignment="Left"
Style="{StaticResource CardTextStyle}"
Text="{x:Bind AppNewestVersion}">
Expand All @@ -260,14 +260,14 @@
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/Update')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.PrimaryButtonToolTip>

<basicInput:ExtendedSplitButton.SecondaryButtonToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/ViewMoreOptions')}"
Placement="Bottom"
VerticalOffset="25" />
VerticalOffset="20" />
</basicInput:ExtendedSplitButton.SecondaryButtonToolTip>

<basicInput:ExtendedSplitButton.Flyout>
Expand All @@ -280,6 +280,13 @@
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE8C8;" Style="{StaticResource SegoeFluentStyle}" />
</MenuFlyoutItem.Icon>

<ToolTipService.ToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/CopyUpgradeText')}"
Placement="Bottom"
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>

<MenuFlyoutItem
Expand All @@ -290,6 +297,13 @@
<MenuFlyoutItem.Icon>
<FontIcon Glyph="&#xE74B;" Style="{StaticResource SegoeFluentStyle}" />
</MenuFlyoutItem.Icon>

<ToolTipService.ToolTip>
<ToolTip
Content="{x:Bind root:ResourceService.GetLocalized('WinGet/InstallWithCmd')}"
Placement="Bottom"
VerticalOffset="20" />
</ToolTipService.ToolTip>
</MenuFlyoutItem>
</menusAndToolbars:AdaptiveMenuFlyout>
</basicInput:ExtendedSplitButton.Flyout>
Expand Down
Loading

0 comments on commit b872527

Please sign in to comment.