Skip to content

Commit eae30d6

Browse files
levinli303claude
andcommitted
Add SelectionHelper to package manifest, use IVector instead of com_array
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5cdee94 commit eae30d6

4 files changed

Lines changed: 11 additions & 7 deletions

File tree

CelestiaAppComponent/SelectionHelper.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,16 +252,19 @@ namespace winrt::CelestiaAppComponent::implementation
252252
return LocalizationHelper::Localize(L"No overview available.", L"No overview for an object");
253253
}
254254

255-
winrt::com_array<CelestiaAppComponent::OverviewTimeLink> SelectionHelper::GetTimeLinks(CelestiaSelection const& selection, CelestiaAppCore const& appCore)
255+
Windows::Foundation::Collections::IVector<CelestiaAppComponent::OverviewTimeLink> SelectionHelper::GetTimeLinks(CelestiaSelection const& selection, CelestiaAppCore const& appCore)
256256
{
257+
auto result = single_threaded_vector<CelestiaAppComponent::OverviewTimeLink>();
257258
auto obj = selection.Object();
258-
if (obj == nullptr) return {};
259+
if (obj == nullptr) return result;
259260
auto body = obj.try_as<CelestiaBody>();
260261
if (body != nullptr)
261262
{
262-
auto links = GetBodyTimeLinks(body, appCore);
263-
return winrt::com_array<CelestiaAppComponent::OverviewTimeLink>(links);
263+
for (auto const& link : GetBodyTimeLinks(body, appCore))
264+
{
265+
result.Append(link);
266+
}
264267
}
265-
return {};
268+
return result;
266269
}
267270
}

CelestiaAppComponent/SelectionHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace winrt::CelestiaAppComponent::implementation
1717
struct SelectionHelper : SelectionHelperT<SelectionHelper>
1818
{
1919
static hstring GetOverview(CelestiaComponent::CelestiaSelection const& selection, CelestiaComponent::CelestiaAppCore const& appCore);
20-
static winrt::com_array<CelestiaAppComponent::OverviewTimeLink> GetTimeLinks(CelestiaComponent::CelestiaSelection const& selection, CelestiaComponent::CelestiaAppCore const& appCore);
20+
static Windows::Foundation::Collections::IVector<CelestiaAppComponent::OverviewTimeLink> GetTimeLinks(CelestiaComponent::CelestiaSelection const& selection, CelestiaComponent::CelestiaAppCore const& appCore);
2121
};
2222
}
2323

CelestiaAppComponent/SelectionHelper.idl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ namespace CelestiaAppComponent
2121
runtimeclass SelectionHelper
2222
{
2323
static String GetOverview(CelestiaComponent.CelestiaSelection selection, CelestiaComponent.CelestiaAppCore appCore);
24-
static OverviewTimeLink[] GetTimeLinks(CelestiaComponent.CelestiaSelection selection, CelestiaComponent.CelestiaAppCore appCore);
24+
static Windows.Foundation.Collections.IVector<OverviewTimeLink> GetTimeLinks(CelestiaComponent.CelestiaSelection selection, CelestiaComponent.CelestiaAppCore appCore);
2525
};
2626
}

CelestiaWinUI/Package.appxmanifest

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188
<ActivatableClass ActivatableClassId="CelestiaAppComponent.RequestResult" ThreadingModel="both" />
189189
<ActivatableClass ActivatableClassId="CelestiaAppComponent.ResourceItem" ThreadingModel="both" />
190190
<ActivatableClass ActivatableClassId="CelestiaAppComponent.SearchObjectEntry" ThreadingModel="both" />
191+
<ActivatableClass ActivatableClassId="CelestiaAppComponent.SelectionHelper" ThreadingModel="both" />
191192
<ActivatableClass ActivatableClassId="CelestiaAppComponent.SettingBaseItem" ThreadingModel="both" />
192193
<ActivatableClass ActivatableClassId="CelestiaAppComponent.SettingBooleanItem" ThreadingModel="both" />
193194
<ActivatableClass ActivatableClassId="CelestiaAppComponent.SettingInt32Item" ThreadingModel="both" />

0 commit comments

Comments
 (0)