작업-UWPActions - UWP

카드 내의 모든 작업 은 UWP 단추로렌더링 되지만 사용자가 해당 작업을 누를 때 발생 하는 상황을 처리 하기 위해 앱에 있습니다 (showcard 작업 ... 자세한 내용은 코드 조각을 참조 하세요.Any actions within the card will render as UWP Button's, but it's up to your app to handle what happens when a user presses them (except for ShowCard actions... see code snippet for more info).

RenderedAdaptiveCard 개체는 이 용도를 위한 Action 이벤트를 제공합니다.The RenderedAdaptiveCard object provides an Action event for this purpose.

// Render a card (as previously shown)
RenderedAdaptiveCard renderedAdaptiveCard =  renderer.RenderAdaptiveCard(card);

// ...

// Attach the event handler for action click events
renderedAdaptiveCard.Action += RenderedAdaptiveCard_Action;

private async void RenderedAdaptiveCard_Action(RenderedAdaptiveCard sender, AdaptiveActionEventArgs args)
{
    if (args.Action is AdaptiveOpenUrlAction openUrlAction)
    {
        await Launcher.LaunchUriAsync(openUrlAction.Url);
    }

    else if (args.Action is AdaptiveShowCardAction showCardAction)
    {
        // This is only fired if, in HostConfig, you set the ShowCard ActionMode to Popup.
        // Otherwise, the renderer will automatically display the card inline without firing this event.
    }

    else if (args.Action is AdaptiveSubmitAction submitAction)
    {
        // Get the data and inputs
        string data = submitAction.DataJson.Stringify();
        string inputs = args.Inputs.AsJson().Stringify();

        // Process them as desired
    }
}