Repository navigation
[UWP] Clean up XamlBuilder #3457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
0d9b13b
c2af276
a3a2b10
b5cba02
e418de2
403ed59
3a776c3
cceb8bc
7ce0aff
3a35dc3
05aec67
23fec98
62a00d6
41f9f2b
e0a6fcb
78aae56
2206eda
1169ddf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
| #pragma once | ||
|
|
||
| namespace AdaptiveNamespace::ActionHelpers | ||
| { | ||
| HRESULT BuildAction(_In_ ABI::AdaptiveNamespace::IAdaptiveActionElement* adaptiveActionElement, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveRenderContext* renderContext, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveRenderArgs* renderArgs, | ||
| _Outptr_ ABI::Windows::UI::Xaml::IUIElement** actionControl); | ||
|
|
||
| HRESULT GetButtonMargin(_In_ ABI::AdaptiveNamespace::IAdaptiveActionsConfig* actionsConfig, | ||
| ABI::Windows::UI::Xaml::Thickness& buttonMargin) noexcept; | ||
|
|
||
| void ArrangeButtonContent(_In_ ABI::AdaptiveNamespace::IAdaptiveActionElement* action, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveActionsConfig* actionsConfig, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveRenderContext* renderContext, | ||
| ABI::AdaptiveNamespace::ContainerStyle containerStyle, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveHostConfig* hostConfig, | ||
| bool allActionsHaveIcons, | ||
| _In_ ABI::Windows::UI::Xaml::Controls::IButton* button); | ||
|
|
||
| HRESULT SetMatchingHeight(_In_ ABI::Windows::UI::Xaml::IFrameworkElement* elementToChange, | ||
| _In_ ABI::Windows::UI::Xaml::IFrameworkElement* elementToMatch); | ||
|
|
||
| HRESULT HandleActionStyling(_In_ ABI::AdaptiveNamespace::IAdaptiveActionElement* adaptiveActionElement, | ||
| _In_ ABI::Windows::UI::Xaml::IFrameworkElement* buttonFrameworkElement, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveRenderContext* renderContext); | ||
|
|
||
| bool WarnForInlineShowCard(_In_ ABI::AdaptiveNamespace::IAdaptiveRenderContext* renderContext, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveActionElement* action, | ||
| const std::wstring& warning); | ||
|
|
||
| void HandleInlineAction(_In_ ABI::AdaptiveNamespace::IAdaptiveRenderContext* renderContext, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveRenderArgs* renderArgs, | ||
| _In_ ABI::Windows::UI::Xaml::Controls::ITextBox* textBox, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveActionElement* inlineAction, | ||
| _COM_Outptr_ ABI::Windows::UI::Xaml::IUIElement** textBoxWithInlineAction); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,20 @@ | |
|
|
||
| #include "AdaptiveActionSet.h" | ||
| #include "AdaptiveActionSetRenderer.h" | ||
| #include "AdaptiveShowCardActionRenderer.h" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this needed? #Closed
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope... looks like some of the other ones are also unneeded. Probably snuck in while I was trying to get things building :) In reply to: 325838868 [](ancestors = 325838868) |
||
| #include "AdaptiveElementParserRegistration.h" | ||
| #include "enums.h" | ||
| #include "Util.h" | ||
| #include "XamlBuilder.h" | ||
| #include "AdaptiveImage.h" | ||
| #include "AdaptiveRenderArgs.h" | ||
| #include "ActionHelpers.h" | ||
|
|
||
| using namespace Microsoft::WRL; | ||
| using namespace Microsoft::WRL::Wrappers; | ||
| using namespace ABI::AdaptiveNamespace; | ||
| using namespace ABI::Windows::Foundation; | ||
| using namespace ABI::Windows::Foundation::Collections; | ||
| using namespace ABI::Windows::UI::Xaml; | ||
| using namespace ABI::Windows::UI::Xaml::Controls; | ||
| using namespace ABI::Windows::UI::Xaml::Controls::Primitives; | ||
|
|
||
| namespace AdaptiveNamespace | ||
| { | ||
|
|
@@ -22,15 +27,6 @@ namespace AdaptiveNamespace | |
| } | ||
| CATCH_RETURN; | ||
|
|
||
| HRESULT AdaptiveActionSetRenderer::Render(_In_ IAdaptiveCardElement* cardElement, | ||
| _In_ IAdaptiveRenderContext* renderContext, | ||
| _In_ IAdaptiveRenderArgs* renderArgs, | ||
| _COM_Outptr_ ABI::Windows::UI::Xaml::IUIElement** result) noexcept try | ||
| { | ||
| return XamlBuilder::BuildActionSet(cardElement, renderContext, renderArgs, result); | ||
| } | ||
| CATCH_RETURN; | ||
|
|
||
| HRESULT AdaptiveActionSetRenderer::FromJson( | ||
| _In_ ABI::Windows::Data::Json::IJsonObject* jsonObject, | ||
| _In_ ABI::AdaptiveNamespace::IAdaptiveElementParserRegistration* elementParserRegistration, | ||
|
|
@@ -42,4 +38,31 @@ namespace AdaptiveNamespace | |
| jsonObject, elementParserRegistration, actionParserRegistration, adaptiveWarnings, element); | ||
| } | ||
| CATCH_RETURN; | ||
|
|
||
| HRESULT AdaptiveActionSetRenderer::Render(_In_ IAdaptiveCardElement* adaptiveCardElement, | ||
| _In_ IAdaptiveRenderContext* renderContext, | ||
| _In_ IAdaptiveRenderArgs* renderArgs, | ||
| _COM_Outptr_ IUIElement** actionSetControl) noexcept try | ||
| { | ||
| ComPtr<IAdaptiveHostConfig> hostConfig; | ||
| RETURN_IF_FAILED(renderContext->get_HostConfig(&hostConfig)); | ||
|
|
||
| if (!XamlHelpers::SupportsInteractivity(hostConfig.Get())) | ||
| { | ||
| renderContext->AddWarning( | ||
| ABI::AdaptiveNamespace::WarningStatusCode::InteractivityNotSupported, | ||
| HStringReference(L"ActionSet was stripped from card because interactivity is not supported").Get()); | ||
| return S_OK; | ||
| } | ||
|
|
||
| ComPtr<IAdaptiveCardElement> cardElement(adaptiveCardElement); | ||
| ComPtr<IAdaptiveActionSet> adaptiveActionSet; | ||
| RETURN_IF_FAILED(cardElement.As(&adaptiveActionSet)); | ||
|
|
||
| ComPtr<IVector<IAdaptiveActionElement*>> actions; | ||
| RETURN_IF_FAILED(adaptiveActionSet->get_Actions(&actions)); | ||
|
|
||
| return XamlHelpers::BuildActionSetHelper(nullptr, adaptiveActionSet.Get(), actions.Get(), renderContext, renderArgs, actionSetControl); | ||
| } | ||
| CATCH_RETURN; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While you're here, maybe remove these Use_decl_annotations here. #Closed