2017-12-07 2 views
1

電子メールと通話機能のボタンを備えたアダプティブカードを作成したいと考えています。アダプティブカードの通話と電子メールのフォーマットが見つかりません。ヒーローカードにはcardActionオブジェクトの機能があるため、アダプティブカードとヒーローカードを組み合わせる方法はありますか?電子メールと通話機能用のボタンを備えたアダプティブカードを作成したいと思います。その可能性のある方法は何ですか?

+0

私の回答、すべてのアップデートを確認しましたか? –

答えて

0

アダプティブカードには、アクションエレメントと設定可能な選択アクションがあります。入力要件を持つカードを作成し、送信アクションを使用して入力を処理します。テキスト入力要素に注意してください、フォーマットは、電子メールまたはTEL

{"type":"AdaptiveCard","version":"1.0","id":"c2de1dd7-c916-4196-a914-0694957aff77","minVersion":"1.0","fallbackText":"","speak":"","body":[{"type":"TextBlock","id":"23af4d94-cf3b-480e-8c28-5a7988b8a26b","text":"Email Address","maxLines":1},{"type":"Input.Text","id":"4a47c737-dbf0-42d0-aa9f-10f4f38bd20f","placeholder":"enter your email here","value":"","style":"email","maxLength":250,"isRequired":false},{"type":"TextBlock","id":"b4f3bce9-2464-473f-9129-48a3740aec8b","size":"large","text":"OR","horizontalAlignment":"center","maxLines":1},{"type":"TextBlock","id":"fe2d84aa-79e7-4fdf-91a0-79a9eb264dc1","text":"Call me","maxLines":1},{"type":"Input.Text","id":"d03d538f-7ead-4959-8a8e-7703dbaf1899","placeholder":"What's your number?","value":"","style":"tel","maxLength":250,"isRequired":false}],"actions":[{"type":"Action.Submit","id":"8421a872-2c4f-4fa2-8254-b1d88503cc8a","data":"","title":"Email Me"},{"type":"Action.Submit","id":"2ccf2819-ad38-492a-80f9-7cd5152fea09","data":"","title":"Call Me"}]} 

enter image description here

0

のいずれかに設定されたヒーローカードはcardActionオブジェクトを持っているので、英雄カードと適応のカードを組み合わせることが方法です。機能性?

ありませんが、AdaptiveCard内のボタンはCardActionオブジェクトを使用して作成されていない、あなたの代わりにdefined in AdaptiveCardあるスキーマを使用することができます。

アクションは、OpenUrlSubmitShowCardの3種類あります。ここではSubmitが必要です。

あなたがC#でAdaptiveCardを作成したい場合は、例えば、それを作成し、このようなメッセージを送ることができます。Submitアクションを使用する場合

AdaptiveCard card = new AdaptiveCard() 
{ 
    Body = new List<CardElement>() 
    { 
     new Container() 
     { 
      Speak = "<s>Hello!</s><s>Send Email!</s>", 
      Items = new List<CardElement>() 
      { 
       new TextBlock() 
       { 
        Text = "Hello!", 
        Weight = TextWeight.Bolder, 
        IsSubtle = true 
       }, 
       new TextBlock() 
       { 
        Text = "Send Email!", 
        Wrap = true 
       }, 
       new TextInput() 
       { 
        Id = "EmailAddTo", 
        Placeholder = "To:" 
       }, 
       new TextInput() 
       { 
        Id = "EmailAddFrom", 
        Placeholder = "From:" 
       }, 
       new TextInput() 
       { 
        Id = "Subject", 
        Placeholder = "Subject:" 
       }, 
       new TextInput() 
       { 
        Id = "Content", 
        Placeholder = "Content:", 
        IsMultiline = true,       
       } 
      } 
     } 
    }, 
    Actions = new List<ActionBase>() 
    { 
     new SubmitAction() 
     { 
      Title = "Send Email", 
      DataJson = "{\"Type\": \"EmailSend\"}" 
     } 
    } 
}; 

Attachment attachment = new Attachment() 
{ 
    ContentType = AdaptiveCard.ContentType, 
    Content = card 
}; 

var reply = context.MakeMessage(); 
reply.Attachments.Add(attachment); 

await context.PostAsync(reply,CancellationToken.None); 

、ボットフレームワークは、提出を処理すると、あなたのボットが届きますそのValueを持つ新しいIMessageActivity、あなたは、このような例のためにあなたのコードでそれを扱うことができます。詳細については

private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> result) 
{ 
    var message = await result; 

    if (message.Value != null) 
    { 
     // Got an Action Submit 
     dynamic value = message.Value; 
     string submitType = value.Type.ToString(); 
     switch (submitType) 
     { 
      case "EmailSend": 
       /* */ 
       return; 
     } 
    } 
} 

、あなたは公式を参照することができます。

関連する問題