Skip to content

Instantly share code, notes, and snippets.

💭
theres nothing to see here...move along!

Tim Cadenbach DeeJayTC

💭
theres nothing to see here...move along!
Block or report user

Report or block DeeJayTC

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:5140b608030fd02ee0d7cabf7071a110
// 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>(),
};
View gist:ac970114ed5fa37dbbb6b1abaf7fbb20
{
"title": "My list of people:",
"count": 4,
"people": [{
"firstName": "Micky",
"lastName": "Mouse",
"age": 44
},
{
"firstName": "Donald",
View example properties.json
{
"{<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)*"
}
View getTemplate.cs
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");
View adaptivecard2.json
@if(Model.Task.TaskDueDate != null)
{
<text>,
{
"title": "Due Date",
"value": "@Model.Task.TaskDueDate.ToShortDateString()"
}
</text>
}
View CardRenderService.cs
//the underlying CardRenderService
public class CardRenderService
{
private RazorLightEngine Engine;
public CardRenderService()
{
Engine = new RazorLightEngineBuilder().UseMemoryCachingProvider().Build();
}
View example.cs
// Create an adaptive card and send it
var payload = await _cardservice.RenderCard(templateKey, template, data);
var result = await client.PostAsync(url, new StringContent(payload));
View status.cs
using AdaptiveCards;
// ...
AdaptiveCard card = new AdaptiveCard();
var container = new AdaptiveContainer();
var column = new AdaptiveColumn(){Width=Auto};
column.Items.Add(new AdaptiveImage(
@DeeJayTC
DeeJayTC / adaptivecard.json
Last active Feb 21, 2019
Adaptive Cards made easy :)
View adaptivecard.json
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
View moreExamples.cs
// Lets just like a comment
var ok = await client.Projects.Reactions.LikeItem("comment", "commentId");
// we can even send messages on teamwork chat!
var ok = await client.Projects.Chat.SendMessage("the message i want to send", "the RoomId");
// Update your status
var ok = await client.Projects.Me.AddNewStatusMessage("Gone Fishin");
You can’t perform that action at this time.