This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "AdaptiveCard", | |
"body": [ | |
{ | |
"type": "ColumnSet", | |
"columns": [ | |
{ | |
"type": "Column", | |
"width": "20px", | |
"items": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create card | |
var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0)) | |
{ | |
// Use LINQ to turn the choices into submit actions | |
Actions = choices.Select(choice => new AdaptiveSubmitAction | |
{ | |
Title = choice, | |
Data = choice, // This will be a string | |
}).ToList<AdaptiveAction>(), | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"title": "My list of people:", | |
"count": 4, | |
"people": [{ | |
"firstName": "Micky", | |
"lastName": "Mouse", | |
"age": 44 | |
}, | |
{ | |
"firstName": "Donald", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"{<property>}": "Implicitly binds to `$data.<property>`", | |
"$data": "The current data object", | |
"$root": "The root data object. Useful when iterating to escape to parent object", | |
"$index": "The current index when iterating", | |
"$host": "Access properties of the host *(not working yet)*" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public async Task<string> GetTemplate() | |
{ | |
var status = new Status() { | |
Date = DateTime.Now, | |
User = new User() { | |
FirstName = NameGenerator.GenerateFirstName(Gender.Male), | |
LastName = NameGenerator.GenerateLastName() | |
} | |
}; | |
var tpl = await System.IO.File.ReadAllTextAsync("./status.json"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@if(Model.Task.TaskDueDate != null) | |
{ | |
<text>, | |
{ | |
"title": "Due Date", | |
"value": "@Model.Task.TaskDueDate.ToShortDateString()" | |
} | |
</text> | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//the underlying CardRenderService | |
public class CardRenderService | |
{ | |
private RazorLightEngine Engine; | |
public CardRenderService() | |
{ | |
Engine = new RazorLightEngineBuilder().UseMemoryCachingProvider().Build(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create an adaptive card and send it | |
var payload = await _cardservice.RenderCard(templateKey, template, data); | |
var result = await client.PostAsync(url, new StringContent(payload)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using AdaptiveCards; | |
// ... | |
AdaptiveCard card = new AdaptiveCard(); | |
var container = new AdaptiveContainer(); | |
var column = new AdaptiveColumn(){Width=Auto}; | |
column.Items.Add(new AdaptiveImage( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"type": "AdaptiveCard", | |
"body": [ | |
{ | |
"type": "Container", | |
"items": [ | |
{ | |
"type": "ColumnSet", | |
"columns": [ | |
{ |