├── Library
├── AdaptiveCards
│ ├── docs
│ │ └── .gitignore
│ ├── Globals.cs
│ ├── ILogWarnings.cs
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── TypedEventHandler.cs
│ ├── AdaptiveCards.NET.asmdef
│ ├── MarkedNet
│ │ ├── MarkedNet
│ │ │ ├── Objects.cs
│ │ │ ├── Token.cs
│ │ │ ├── TokensResult.cs
│ │ │ ├── Marked.cs
│ │ │ └── Options.cs
│ │ ├── HtmlRenderer.cs
│ │ ├── EmojiRenderer.cs
│ │ ├── License.txt
│ │ └── MarkedNetLicense.txt
│ ├── Rendering
│ │ ├── ImageSetConfig.cs
│ │ ├── ImageSizesConfig.cs
│ │ ├── HeadingsConfig.cs
│ │ ├── AdaptiveCardConfig.cs
│ │ ├── InputsConfig.cs
│ │ ├── AdaptiveRenderException.cs
│ │ ├── SeparatorConfig.cs
│ │ ├── SpacingsConfig.cs
│ │ ├── AdaptiveConfigBase.cs
│ │ ├── FontStyleConfig.cs
│ │ ├── HighlightColorConfig.cs
│ │ ├── ContainerStyleConfig.cs
│ │ ├── FontStylesConfig.cs
│ │ ├── LabelConfig.cs
│ │ ├── MediaConfig.cs
│ │ ├── ErrorMessageConfig.cs
│ │ ├── FactSetConfig.cs
│ │ ├── AdaptiveRenderTransformers.cs
│ │ ├── RenderedAdaptiveCardBase.cs
│ │ ├── FontWeightsConfig.cs
│ │ ├── InputsLabelConfig.cs
│ │ ├── RenderedAdaptiveCardInputs.cs
│ │ ├── TextBlockConfig.cs
│ │ ├── AdaptiveRenderArgs.cs
│ │ ├── FontSizesConfig.cs
│ │ ├── AdaptiveCardRendererBase.cs
│ │ └── AdaptiveActionHandlers.cs
│ ├── package.json
│ ├── AdaptiveTableCell.cs
│ ├── AdaptiveFontStyle.cs
│ ├── AdaptiveUnknownElement.cs
│ ├── AdaptiveColumnWidth.cs
│ ├── AdaptiveTextBlockStyle.cs
│ ├── AdaptiveCardParseResult.cs
│ ├── AdaptiveException.cs
│ ├── AdaptiveActionMode.cs
│ ├── AdaptiveVerticalAlignment.cs
│ ├── AdaptiveTypedBaseElementConverter.cs
│ ├── AdaptiveAssociatedInputs.cs
│ ├── AdaptiveColumnSize.cs
│ ├── AdaptiveSerializationException.cs
│ ├── AdaptiveChoiceInputStyle.cs
│ ├── AdaptiveVerticalContentAlignment.cs
│ ├── RemoteResourceInformation.cs
│ ├── AdaptiveHorizontalContentAlignment.cs
│ ├── AdaptiveFallbackException.cs
│ ├── AdaptiveImageStyle.cs
│ ├── AdaptiveHorizontalAlignment.cs
│ ├── AdaptiveTextWeight.cs
│ ├── AdaptiveFactSet.cs
│ ├── AdaptiveShowCardAction.cs
│ ├── AdaptiveImageSize.cs
│ ├── AdaptiveTokenExchangeResource.cs
│ ├── AdaptiveToggleVisibilityAction.cs
│ ├── AdaptiveSpacing.cs
│ ├── AdaptiveTextSize.cs
│ ├── AdaptiveTextInputStyle.cs
│ ├── AdaptiveAuthCardButton.cs
│ ├── AdaptiveTextColor.cs
│ ├── AdaptiveImageSet.cs
│ ├── AdaptiveColumnSet.cs
│ ├── AdaptiveContainerStyle.cs
│ ├── IAdaptiveTextElement.cs
│ ├── AdaptiveInput.cs
│ ├── AdaptiveInline.cs
│ ├── AdaptiveRefresh.cs
│ ├── AdaptiveMediaSource.cs
│ ├── AdaptiveActionSet.cs
│ ├── AdaptiveOpenUrlAction.cs
│ ├── AdaptiveMedia.cs
│ ├── AdaptiveRichTextBlock.cs
│ ├── AdaptiveChoice.cs
│ ├── AdaptiveAuthentication.cs
│ ├── AdaptiveColumn.cs
│ ├── AdaptiveFact.cs
│ ├── AdaptiveCollectionWithContentAlignment.cs
│ ├── IgnoreNullEnumConverter.cs
│ ├── AdaptiveImageFillMode.cs
│ ├── IgnoreEmptyItemsConverter.cs
│ ├── StrictIntConverter.cs
│ ├── ToggleElementsConverter.cs
│ ├── AdaptiveDateInput.cs
│ ├── AdaptiveTimeInput.cs
│ ├── IgnoreDefaultStringEnumConverter.cs
│ ├── AdaptiveInlinesConverter.cs
│ ├── AdaptiveNumberInput.cs
│ └── AdaptiveToggleInput.cs
├── AdaptiveCards.Rendering.Wpf.Xceed
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── XceedChoiceSetInput.cs
│ ├── XceedAdaptiveCardRenderer.cs
│ ├── XceedNumberInput.cs
│ ├── AdaptiveCards.Rendering.Wpf.Xceed.csproj
│ └── XceedInputValue.cs
├── AdaptiveCards.Rendering.Wpf
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── AdaptiveMediaEventArgs.cs
│ ├── AdaptiveActionEventArgs.cs
│ ├── MissingInputEventArgs.cs
│ ├── MissingInputException.cs
│ ├── RenderedAdaptiveCardImage.cs
│ ├── XamlUtilities.cs
│ ├── AdaptiveDateInputRenderer.cs
│ ├── AdaptiveTimeInputRenderer.cs
│ ├── Helpers
│ │ └── TaskExtensions.cs
│ ├── AdaptiveNumberInputRenderer.cs
│ ├── AdaptiveToggleInputRenderer.cs
│ ├── RenderedAdaptiveCard.cs
│ ├── AdaptiveImageSetRenderer.cs
│ ├── TagContent.cs
│ ├── AdaptiveCards.Rendering.Wpf.csproj
│ └── PreFetchImageVisitor.cs
└── AdaptiveCards.Rendering.Wpf.Core
│ └── AdaptiveCards.Rendering.Wpf.Core.csproj
├── Samples
├── AdaptiveCards.Sample.ImageRender
│ ├── .gitignore
│ ├── Properties
│ │ └── launchSettings.json
│ ├── AdaptiveCards.Sample.ImageRender.csproj
│ └── README.md
├── WPFVisualizer
│ ├── FodyWeavers.xml
│ ├── Properties
│ │ ├── Settings.settings
│ │ └── Settings.Designer.cs
│ ├── CustomElements
│ │ ├── MyCustomAction.cs
│ │ └── MyCustomRating.cs
│ ├── App.xaml
│ ├── ShowCardWindow.xaml
│ ├── ViewImageWindow.xaml
│ ├── PRIVACY.md
│ ├── App.config
│ ├── ViewImageWindow.xaml.cs
│ ├── SyntaxHighlighting
│ │ └── JSON.xml
│ ├── App.xaml.cs
│ └── ShowCardWindow.xaml.cs
├── WPFVisualizer.PackageProject
│ ├── Images
│ │ ├── BadgeLogo.scale-100.png
│ │ ├── BadgeLogo.scale-200.png
│ │ ├── BadgeLogo.scale-400.png
│ │ ├── StoreLogo.scale-100.png
│ │ ├── StoreLogo.scale-200.png
│ │ ├── StoreLogo.scale-400.png
│ │ ├── Square44x44Logo.scale-100.png
│ │ ├── Square44x44Logo.scale-200.png
│ │ ├── Square44x44Logo.scale-400.png
│ │ ├── Square150x150Logo.scale-100.png
│ │ ├── Square150x150Logo.scale-200.png
│ │ ├── Square150x150Logo.scale-400.png
│ │ ├── Square44x44Logo.targetsize-16.png
│ │ ├── Square44x44Logo.targetsize-48.png
│ │ ├── Square44x44Logo.targetsize-256.png
│ │ ├── Square44x44Logo.altform-unplated_targetsize-16.png
│ │ ├── Square44x44Logo.altform-unplated_targetsize-48.png
│ │ └── Square44x44Logo.altform-unplated_targetsize-256.png
│ ├── AdaptiveCards.Sample.WPFVisualizer.PackageProject_TemporaryKey.pfx
│ └── Package.appxmanifest
├── AdaptiveCards.Core.Sample.ImageRender
│ ├── Properties
│ │ └── launchSettings.json
│ ├── AdaptiveCards.Core.Sample.ImageRender.csproj
│ └── README.md
└── ImageRendererServer
│ ├── wwwroot
│ └── Styles
│ │ └── MyStyles.xaml
│ ├── Properties
│ └── launchSettings.json
│ ├── Program.cs
│ ├── ImageRendererServer.csproj
│ └── Startup.cs
├── .vscode
├── tasks.json
└── launch.json
├── custom.props
├── Test
└── AdaptiveCards.Test
│ ├── AdaptiveCards.Test.csproj
│ ├── AdaptiveInputTests.cs
│ └── AdaptiveSchemaVersionTests.cs
├── LICENSE
├── RunAllTests.ps1
├── Build
├── SignNugetConfig.xml
└── SignConfig.xml
└── .pipelines
└── dotnet-ci.yml
/Library/AdaptiveCards/docs/.gitignore:
--------------------------------------------------------------------------------
1 | *.xml
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Sample.ImageRender/.gitignore:
--------------------------------------------------------------------------------
1 | *.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/FodyWeavers.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Globals.cs:
--------------------------------------------------------------------------------
1 | namespace AdaptiveCards
2 | {
3 | class Globals
4 | {
5 | public static readonly string ObjectModelVersion = "1.5";
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-100.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-200.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/BadgeLogo.scale-400.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-100.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-200.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/StoreLogo.scale-400.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-100.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.scale-400.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-100.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-100.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square150x150Logo.scale-400.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-16.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-48.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.targetsize-256.png
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Sample.ImageRender/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "AdaptiveCards.Sample.ImageRender": {
4 | "commandName": "Project",
5 | "commandLineArgs": "-r -o ./out"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-16.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-48.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/Images/Square44x44Logo.altform-unplated_targetsize-256.png
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer.PackageProject/AdaptiveCards.Sample.WPFVisualizer.PackageProject_TemporaryKey.pfx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/microsoft/AdaptiveCards-.NET/main/Samples/WPFVisualizer.PackageProject/AdaptiveCards.Sample.WPFVisualizer.PackageProject_TemporaryKey.pfx
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf.Xceed/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 |
4 | #if DELAY_SIGN
5 | [assembly: AssemblyKeyFileAttribute(@"../../../../35MSSharedLib1024.snk")]
6 | [assembly: AssemblyDelaySignAttribute(true)]
7 | #endif
8 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/ILogWarnings.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 |
5 | namespace AdaptiveCards
6 | {
7 | internal interface ILogWarnings
8 | {
9 | List Warnings { get; set; }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Reflection;
5 |
6 | #if DELAY_SIGN
7 | [assembly: AssemblyKeyFileAttribute(@"../../../../35MSSharedLib1024.snk")]
8 | [assembly: AssemblyDelaySignAttribute(true)]
9 | #endif
10 |
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "label": "build",
6 | "command": "dotnet",
7 | "type": "process",
8 | "args": [
9 | "build",
10 | "${workspaceFolder}/Test/AdaptiveCards.Rendering.Html.Test/AdaptiveCards.Rendering.Html.Test.csproj"
11 | ],
12 | "problemMatcher": "$msCompile"
13 | }
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/TypedEventHandler.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards
6 | {
7 | public delegate void TypedEventHandler(
8 | TSender sender,
9 | TEventArgs e
10 | ) where TEventArgs : EventArgs;
11 | }
12 |
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Core.Sample.ImageRender/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "AdaptiveCards.Core.Sample.ImageRender": {
4 | "commandName": "Project",
5 | "commandLineArgs": "..\\..\\..\\..\\..\\..\\..\\samples\\v1.0\\Scenarios -r -i -o ./out --host-config ..\\..\\..\\..\\..\\..\\..\\samples\\HostConfig\\windows-notification.json"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/CustomElements/MyCustomAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using AdaptiveCards;
4 |
5 | namespace WpfVisualizer
6 | {
7 | public class MyCustomAction : AdaptiveAction
8 | {
9 | public override string Type { get; set; } = "Action.MyCustomAction";
10 |
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveCards.NET.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Microsoft.AdaptiveCards.NET",
3 | "rootNamespace": "AdaptiveCards",
4 | "references": [
5 | ],
6 | "includePlatforms": [
7 | ],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": true,
13 | "defineConstraints": [],
14 | "versionDefines": [],
15 | "noEngineReferences": false
16 | }
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Reflection;
5 | using System.Windows;
6 |
7 | #if DELAY_SIGN
8 | [assembly: AssemblyKeyFileAttribute(@"../../../../35MSSharedLib1024.snk")]
9 | [assembly: AssemblyDelaySignAttribute(true)]
10 | #endif
11 | [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]
12 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/MarkedNet/Objects.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.MarkedNet
7 | {
8 | public class TableCellFlags
9 | {
10 | public bool Header { get; set; }
11 | public string Align { get; set; }
12 | }
13 |
14 | public class LinkObj
15 | {
16 | public string Href { get; set; }
17 | public string Title { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/custom.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1
5 | 1
6 |
7 | 1.1.0
8 | AdaptiveCards
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Samples/ImageRendererServer/wwwroot/Styles/MyStyles.xaml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/ImageSetConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 |
9 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
10 | public class ImageSetConfig
11 | {
12 | public ImageSetConfig() { }
13 |
14 | public AdaptiveImageSize ImageSize { get; set; } = AdaptiveImageSize.Medium;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/ImageSizesConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class ImageSizesConfig
10 | {
11 | public int Small { get; set; } = 40;
12 |
13 | public int Medium { get; set; } = 80;
14 |
15 | public int Large { get; set; } = 160;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.microsoft.adaptivecards.net",
3 | "version": "%version%",
4 | "displayName": "Adaptive Cards",
5 | "description": "For incorporating Adaptive Cards in Unity.",
6 | "author": "Microsoft",
7 | "license": "MIT",
8 | "licensesUrl": "https://github.com/microsoft/AdaptiveCards/blob/main/LICENSE",
9 | "unity": "2020.3",
10 | "documentationUrl": "",
11 | "changelogUrl": "",
12 | "keywords": [
13 | "AdaptiveCards"
14 | ],
15 | "dependencies": {
16 | "com.unity.nuget.newtonsoft-json": "2.0.2"
17 | }
18 | }
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/App.xaml:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/AdaptiveMediaEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards.Rendering.Wpf
6 | {
7 | public class AdaptiveMediaEventArgs : EventArgs
8 | {
9 | public AdaptiveMediaEventArgs(AdaptiveMedia media)
10 | {
11 | Media = media;
12 | }
13 |
14 | ///
15 | /// The clicked media
16 | ///
17 | public AdaptiveMedia Media { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/HeadingsConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class HeadingsConfig
10 | {
11 | ///
12 | /// Level of heading text, used only if underlying platform requires it.
13 | ///
14 | public int Level { get; set; } = 2;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/AdaptiveActionEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards.Rendering.Wpf
6 | {
7 | public class AdaptiveActionEventArgs : EventArgs
8 | {
9 | public AdaptiveActionEventArgs(AdaptiveAction action)
10 | {
11 | Action = action;
12 | }
13 |
14 | ///
15 | /// The action that fired
16 | ///
17 | public AdaptiveAction Action { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTableCell.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | using System.Xml.Serialization;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Represents a cell within a row of a Table element.
10 | ///
11 |
12 | #if !NETSTANDARD1_3
13 | [XmlType(TypeName = AdaptiveTableCell.TypeName)]
14 | #endif
15 | public class AdaptiveTableCell : AdaptiveContainer
16 | {
17 | ///
18 | public new const string TypeName = "TableCell";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/HtmlRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.MarkedNet;
7 |
8 | namespace Microsoft.MarkedNet
9 | {
10 | ///
11 | /// Renderer which renders to HTML with Emoji Support
12 | ///
13 | public class HtmlRenderer : EmojiMarkdownRenderer
14 | {
15 | public HtmlRenderer() : base()
16 | {
17 | }
18 |
19 | public HtmlRenderer(Options options) : base(options)
20 | {
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/MissingInputEventArgs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Windows;
5 |
6 | namespace AdaptiveCards.Rendering.Wpf
7 | {
8 | public class MissingInputEventArgs : EventArgs
9 | {
10 | public MissingInputEventArgs(AdaptiveInput input, FrameworkElement frameworkElement)
11 | {
12 | this.FrameworkElement = frameworkElement;
13 | this.AdaptiveInput = input;
14 | }
15 |
16 | public FrameworkElement FrameworkElement { get; private set; }
17 |
18 | public AdaptiveInput AdaptiveInput { get; private set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/ImageRendererServer/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "iisSettings": {
3 | "windowsAuthentication": false,
4 | "anonymousAuthentication": true,
5 | "iisExpress": {
6 | "applicationUrl": "http://localhost:50959/",
7 | "sslPort": 0
8 | }
9 | },
10 | "profiles": {
11 | "IIS Express": {
12 | "commandName": "IISExpress",
13 | "launchBrowser": true,
14 | "environmentVariables": {
15 | "ASPNETCORE_ENVIRONMENT": "Development"
16 | }
17 | },
18 | "ImageRendererServer": {
19 | "commandName": "Project",
20 | "launchBrowser": true,
21 | "environmentVariables": {
22 | "ASPNETCORE_ENVIRONMENT": "Development"
23 | },
24 | "applicationUrl": "http://localhost:50960/"
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/MissingInputException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Windows;
5 |
6 | namespace AdaptiveCards.Rendering.Wpf
7 | {
8 | public class MissingInputException : Exception
9 | {
10 | public MissingInputException(string message, AdaptiveInput input, FrameworkElement frameworkElement)
11 | : base(message)
12 | {
13 | this.FrameworkElement = frameworkElement;
14 | this.AdaptiveInput = input;
15 | }
16 |
17 | public FrameworkElement FrameworkElement { get; set; }
18 |
19 | public AdaptiveInput AdaptiveInput { get; set; }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveFontStyle.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls the font type of the TextBlock Elements
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveFontType
13 | {
14 | ///
15 | /// The default font type for general use
16 | ///
17 | Default,
18 |
19 | ///
20 | /// The monospace font type
21 | ///
22 | Monospace
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/RenderedAdaptiveCardImage.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 | using System.IO;
5 |
6 | namespace AdaptiveCards.Rendering.Wpf
7 | {
8 | public class RenderedAdaptiveCardImage : RenderedAdaptiveCardBase
9 | {
10 | ///
11 | /// The rendered image stream as image/png
12 | ///
13 | public Stream ImageStream { get; }
14 |
15 | public RenderedAdaptiveCardImage(Stream stream, AdaptiveCard originatingCard, IList warnings) : base(originatingCard, warnings)
16 | {
17 | ImageStream = stream;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveUnknownElement.cs:
--------------------------------------------------------------------------------
1 | // Copyright (C) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | namespace AdaptiveCards
5 | {
6 | ///
7 | /// Represents an unknown element encountered while parsing.
8 | ///
9 | public class AdaptiveUnknownElement : AdaptiveElement
10 | {
11 | ///
12 | public override string Type { get; set; }
13 | }
14 |
15 | ///
16 | /// Represents an unknown action encountered while parsing.
17 | ///
18 | public class AdaptiveUnknownAction : AdaptiveAction
19 | {
20 | ///
21 | public override string Type { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveColumnWidth.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | namespace AdaptiveCards
4 | {
5 | ///
6 | /// Controls the horizontal size (width) of Column.
7 | ///
8 | public class AdaptiveColumnWidth
9 | {
10 | ///
11 | /// The width of the Column is optimally chosen depending on the space available in the element's container
12 | ///
13 | public const string Auto = "auto";
14 |
15 | ///
16 | /// The width of the Column adjusts to match that of its container
17 | ///
18 | public const string Stretch = "stretch";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTextBlockStyle.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Indicates TextBlock element's content type.
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveTextBlockStyle
13 | {
14 | ///
15 | /// The content is a paragraph (default).
16 | ///
17 | Paragraph = 0,
18 |
19 | ///
20 | /// The content is a heading.
21 | ///
22 | Heading = 1,
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/AdaptiveCardConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Contains options for the AdaptiveCard element.
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class AdaptiveCardConfig : AdaptiveConfigBase
13 | {
14 | ///
15 | /// Determines whether custom styles should be honored.
16 | ///
17 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public bool AllowCustomStyle { get; set; }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveCardParseResult.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// The result of parsing an AdaptiveCard from JSON.
9 | ///
10 | public class AdaptiveCardParseResult
11 | {
12 | ///
13 | /// The parsed card object.
14 | ///
15 | public AdaptiveCard Card { get; set; }
16 |
17 | ///
18 | /// A collection of any warnings that might have been encountered when parsing the card.
19 | ///
20 | public List Warnings { get; } = new List();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/ShowCardWindow.xaml:
--------------------------------------------------------------------------------
1 |
2 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Represents an exception thrown by Adaptive Cards itself.
9 | ///
10 | public class AdaptiveException : Exception
11 | {
12 | ///
13 | public AdaptiveException()
14 | {
15 | }
16 |
17 | ///
18 | public AdaptiveException(string message) : base(message)
19 | {
20 | }
21 |
22 | ///
23 | public AdaptiveException(string message, Exception innerException) : base(message, innerException)
24 | {
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/EmojiRenderer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Microsoft.MarkedNet;
7 |
8 | namespace Microsoft.MarkedNet
9 | {
10 | ///
11 | /// Renderer which renders emoji markdown to unicode
12 | ///
13 | public class EmojiMarkdownRenderer : MarkdownRenderer
14 | {
15 | public EmojiMarkdownRenderer() : base()
16 | {
17 | }
18 |
19 | public EmojiMarkdownRenderer(Options options) : base(options)
20 | {
21 | }
22 |
23 | public override string Preprocess(string text)
24 | {
25 | return EmojiConverter.ConvertMarkupToEmoji(text);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/MarkedNet/Token.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 |
7 | namespace Microsoft.MarkedNet
8 | {
9 | public class Token
10 | {
11 | public string Text { get; set; }
12 | public string Type { get; set; }
13 |
14 |
15 | public int Depth { get; set; }
16 | public bool Escaped { get; set; }
17 | public string Lang { get; set; }
18 | public bool Ordered { get; set; }
19 |
20 | public int Start { get; set; }
21 |
22 | public bool Pre { get; set; }
23 |
24 | public IList Header { get; set; }
25 | public IList Align { get; set; }
26 | public IList> Cells { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveActionMode.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Determines whether the action should be displayed as a button or in the overflow menu.
9 | ///
10 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
11 | public enum AdaptiveActionMode
12 | {
13 | ///
14 | /// Action is displayed as a button.
15 | ///
16 | Primary,
17 |
18 | ///
19 | /// Action is placed in an overflow menu (typically a popup menu under a ... button).
20 | ///
21 | Secondary
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveVerticalAlignment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Defines the vertical alignment behavior of an element.
10 | ///
11 | [JsonConverter(typeof(StringEnumConverter), true)]
12 | public enum AdaptiveVerticalAlignment
13 | {
14 | ///
15 | /// Align to the top.
16 | ///
17 | Top,
18 |
19 | ///
20 | /// Centered.
21 | ///
22 | Center,
23 |
24 | ///
25 | /// Align to the bottom.
26 | ///
27 | Bottom
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/InputsConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Properties which control rendering of media
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class InputsConfig
13 | {
14 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
15 | public LabelConfig Label { get; set; } = new LabelConfig();
16 |
17 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public ErrorMessageConfig ErrorMessage { get; set; } = new ErrorMessageConfig();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/ViewImageWindow.xaml:
--------------------------------------------------------------------------------
1 |
2 |
11 |
12 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTypedBaseElementConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// JsonConverters that deserialize to AdaptiveCards elements and use ParseContext must inherit this class.
9 | /// ParseContext provides id generation, id collision detections, and other useful services during deserialization.
10 | ///
11 | public abstract class AdaptiveTypedBaseElementConverter : JsonConverter
12 | {
13 | ///
14 | /// The to use while parsing in AdaptiveCards.
15 | ///
16 | public ParseContext ParseContext { get; set; } = new ParseContext();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveAssociatedInputs.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls which inputs are associated with a given submit action
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveAssociatedInputs
13 | {
14 | ///
15 | /// Gathers and validates inputs from the current card and any parent cards
16 | ///
17 | Auto = 0,
18 |
19 | ///
20 | /// Does not gather or validate any inputs on submit
21 | ///
22 | None = 1
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Samples/ImageRendererServer/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 | using Microsoft.AspNetCore;
9 | using Microsoft.AspNetCore.Hosting;
10 | using Microsoft.Extensions.Configuration;
11 | using Microsoft.Extensions.Logging;
12 |
13 | namespace ImageRendererServer
14 | {
15 | public class Program
16 | {
17 | public static void Main(string[] args)
18 | {
19 | BuildWebHost(args).Run();
20 | }
21 |
22 | public static IWebHost BuildWebHost(string[] args) =>
23 | WebHost.CreateDefaultBuilder(args)
24 | .UseStartup()
25 | .Build();
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Core.Sample.ImageRender/AdaptiveCards.Core.Sample.ImageRender.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.0
6 |
7 |
8 |
9 |
10 | x86
11 | false
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/MarkedNet/TokensResult.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 | namespace Microsoft.MarkedNet
7 | {
8 | public class TokensResult
9 | {
10 | public IList Tokens { get; set; }
11 | public IDictionary Links { get; set; }
12 | public int Length { get { return Tokens.Count; } }
13 |
14 | public IEnumerable Reverse()
15 | {
16 | return Tokens.Reverse();
17 | }
18 |
19 | public TokensResult()
20 | {
21 | Tokens = new List();
22 | Links = new Dictionary();
23 | }
24 |
25 |
26 | public void Add(Token token)
27 | {
28 | Tokens.Add(token);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/PRIVACY.md:
--------------------------------------------------------------------------------
1 | # Privacy Policy
2 |
3 | This privacy notice discloses the privacy practices for the Adaptive Cards WPF Visualizer. This privacy notice applies solely to information collected by this app. It will notify you of the following:
4 |
5 | 1. What personally identifiable information is collected from you through the app, how it is used and with whom it may be shared.
6 | 1. What choices are available to you regarding the use of your data.
7 | 1. The security procedures in place to protect the misuse of your information.
8 | 1. How you can correct any inaccuracies in the information.
9 |
10 | ## Information Collection, Use, and Sharing
11 | We do not collect any information from the app.
12 |
13 | If you feel that we are not abiding by this privacy policy, you should contact us immediately [via email](adaptivecardstores@microsoft.com).
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/AdaptiveRenderException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards.Rendering
6 | {
7 | public class AdaptiveRenderException : AdaptiveException
8 | {
9 | public AdaptiveRenderException()
10 | {
11 |
12 | }
13 |
14 | public AdaptiveRenderException(string message) : base(message)
15 | {
16 | }
17 |
18 | public AdaptiveRenderException(string message, Exception innerException) : base(message, innerException)
19 | {
20 | }
21 |
22 | ///
23 | /// The fallback text associated with this card, if provided by the card author
24 | ///
25 | public string CardFallbackText { get; set; }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/SeparatorConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 |
9 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
10 | public class SeparatorConfig
11 | {
12 | ///
13 | /// If there is a visible line, how thick should the line be
14 | ///
15 | public int LineThickness { get; set; } = 1;
16 |
17 | ///
18 | /// If there is a visible color, what color to use
19 | ///
20 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
21 | public string LineColor { get; set; } = "#FF707070";
22 |
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/SpacingsConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Specifies how much spacing should be used for the various spacing options
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class SpacingsConfig
13 | {
14 | public int Small { get; set; } = 3;
15 |
16 | public int Default { get; set; } = 8;
17 |
18 | public int Medium { get; set; } = 20;
19 |
20 | public int Large { get; set; } = 30;
21 |
22 | public int ExtraLarge { get; set; } = 40;
23 |
24 | public int Padding { get; set; } = 15;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveColumnSize.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Controls the horizontal size (width) of Column.
9 | ///
10 | [Obsolete("ColumnSize has been deprecated. Use ColumnWidth", false)]
11 | public class AdaptiveColumnSize
12 | {
13 | ///
14 | /// The width of the Column is optimally chosen depending on the space available in the element's container
15 | ///
16 | public const string Auto = "Auto";
17 |
18 | ///
19 | /// The width of the Column adjusts to match that of its container
20 | ///
21 | public const string Stretch = "Stretch";
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveSerializationException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Represents an exception that occurs during serialization.
9 | ///
10 | public class AdaptiveSerializationException : AdaptiveException
11 | {
12 | ///
13 | public AdaptiveSerializationException()
14 | {
15 | }
16 |
17 | ///
18 | public AdaptiveSerializationException(string message) : base(message)
19 | {
20 | }
21 |
22 | ///
23 | public AdaptiveSerializationException(string message, Exception innerException) : base(message, innerException)
24 | {
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/AdaptiveConfigBase.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Linq;
6 | using Newtonsoft.Json.Serialization;
7 |
8 | namespace AdaptiveCards.Rendering
9 | {
10 | ///
11 | /// Base class for configuration-holding renderer classes.
12 | ///
13 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
14 | public abstract class AdaptiveConfigBase
15 | {
16 | ///
17 | /// Holds additional data in a configuration that doesn't map to known properties.
18 | ///
19 | [JsonExtensionData]
20 | public IDictionary AdditionalData { get; set; } = new Dictionary();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveChoiceInputStyle.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// The style of ChoiceInput to display.
10 | ///
11 | [JsonConverter(typeof(StringEnumConverter), true)]
12 | public enum AdaptiveChoiceInputStyle
13 | {
14 | ///
15 | /// Compact display similar to a ComboBox.
16 | ///
17 | Compact,
18 |
19 | ///
20 | /// Expanded display i.e. Checkbox or Radio buttons.
21 | ///
22 | Expanded,
23 |
24 | ///
25 | /// Allows users to filter choices in a choice set.
26 | ///
27 | Filtered
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveVerticalContentAlignment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Controls the vertical alignment of child elements within a container.
9 | ///
10 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
11 | public enum AdaptiveVerticalContentAlignment
12 | {
13 | ///
14 | /// Align to the top.
15 | ///
16 | Top,
17 |
18 | ///
19 | /// Center within the container.
20 | ///
21 | Center,
22 |
23 | ///
24 | /// Align to the bottom of the container.
25 | ///
26 | Bottom
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/FontStyleConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class FontStyleConfig
10 | {
11 | public FontStyleConfig() { }
12 |
13 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
14 | public string FontFamily { get; set; }
15 |
16 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
17 | public FontSizesConfig FontSizes { get; set; } = new FontSizesConfig();
18 |
19 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
20 | public FontWeightsConfig FontWeights { get; set; } = new FontWeightsConfig();
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/HighlightColorConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 | using Newtonsoft.Json.Serialization;
6 |
7 | namespace AdaptiveCards.Rendering
8 | {
9 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
10 | public class HighlightColorConfig
11 | {
12 | public HighlightColorConfig()
13 | {
14 | this.Default = this.Subtle = "#FFFFFF00";
15 | }
16 |
17 | ///
18 | /// Color in #RRGGBB format
19 | ///
20 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
21 | public string Default { get; set; }
22 |
23 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
24 | public string Subtle { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/RemoteResourceInformation.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 |
4 | namespace AdaptiveCards
5 | {
6 | ///
7 | /// Contains information about a remote source.
8 | ///
9 | public struct RemoteResourceInformation
10 | {
11 | readonly string url;
12 | readonly string mimeType;
13 |
14 | ///
15 | /// Initializes a with the given properties.
16 | ///
17 | /// The URL of the remote resource.
18 | /// The mimetype of the remote resource.
19 | public RemoteResourceInformation(string url, string mimeType)
20 | {
21 | this.url = url;
22 | this.mimeType = mimeType;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveHorizontalContentAlignment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Controls the horizontal alignment of child elements within a container.
9 | ///
10 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
11 | public enum AdaptiveHorizontalContentAlignment
12 | {
13 | ///
14 | /// Align to the leading edge of the container.
15 | ///
16 | Left,
17 |
18 | ///
19 | /// Center within the container.
20 | ///
21 | Center,
22 |
23 | ///
24 | /// Align to the trailing edge of the container.
25 | ///
26 | Right
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf.Xceed/XceedChoiceSetInput.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Windows;
6 | using System.Windows.Controls;
7 | using System.Windows.Data;
8 | using Xceed.Wpf.Toolkit;
9 |
10 | namespace AdaptiveCards.Rendering.Wpf
11 | {
12 | public static class XceedChoiceSetInput
13 | {
14 | public static FrameworkElement Render(AdaptiveChoiceSetInput input, AdaptiveRenderContext context)
15 | {
16 | // Use xceed's WatermarkComboBox to support placeholder
17 | var comboBox = new WatermarkComboBox
18 | {
19 | Watermark = input.Placeholder
20 | };
21 |
22 | return AdaptiveChoiceSetRenderer.RenderHelper(new Grid(), comboBox, new StackPanel(), input, context);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Sample.ImageRender/AdaptiveCards.Sample.ImageRender.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net4.5.2
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/ViewImageWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.IO;
4 | using System.Windows;
5 | using System.Windows.Media.Imaging;
6 |
7 | namespace WpfVisualizer
8 | {
9 | ///
10 | /// Interaction logic for ViewImageWindow.xaml
11 | ///
12 | public partial class ViewImageWindow : Window
13 | {
14 | public ViewImageWindow(Stream sourceImageStream)
15 | {
16 | InitializeComponent();
17 |
18 | var localStream = new MemoryStream();
19 | sourceImageStream.CopyTo(localStream);
20 | localStream.Position = 0;
21 | var source = new BitmapImage();
22 | source.BeginInit();
23 | source.StreamSource = localStream;
24 | source.EndInit();
25 | PreviewImage.Source = source;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Test/AdaptiveCards.Test/AdaptiveCards.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | false
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/MarkedNet/Marked.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 |
6 |
7 | namespace Microsoft.MarkedNet
8 | {
9 | public class Marked
10 | {
11 | public Options Options { get; set; }
12 |
13 |
14 | public Marked()
15 | : this(null)
16 | {
17 | }
18 |
19 | public Marked(Options options)
20 | {
21 | Options = options ?? new Options();
22 | }
23 |
24 |
25 | public virtual string Parse(string src)
26 | {
27 | if (String.IsNullOrEmpty(src))
28 | {
29 | return src;
30 | }
31 |
32 | src = Options.Renderer.Preprocess(src);
33 | var tokens = Lexer.Lex(src, Options);
34 | var result = Parser.Parse(tokens, Options);
35 | return Options.Renderer.Postprocess(result);
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveFallbackException.cs:
--------------------------------------------------------------------------------
1 | // Copyright (C) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// An exception thrown while processing fallback.
9 | ///
10 | ///
11 | /// This exception is intended to be caught and handled by an element that has a fallback action.
12 | ///
13 | public class AdaptiveFallbackException: AdaptiveException
14 | {
15 | ///
16 | public AdaptiveFallbackException()
17 | {
18 | }
19 |
20 | ///
21 | public AdaptiveFallbackException(string message) : base(message)
22 | {
23 | }
24 |
25 | ///
26 | public AdaptiveFallbackException(string message, Exception innerException) : base(message, innerException)
27 | {
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/ContainerStyleConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class ContainerStyleConfig
10 | {
11 | public ContainerStyleConfig() { }
12 |
13 | ///
14 | /// The background color to use for this container
15 | ///
16 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
17 | public string BackgroundColor { get; set; } = "#FFFFFFFF";
18 |
19 | ///
20 | /// The font colors to use for this container
21 | ///
22 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
23 | public ForegroundColorsConfig ForegroundColors { get; set; } = new ForegroundColorsConfig();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveImageStyle.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls the way Image elements are displayed.
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveImageStyle
13 | {
14 | ///
15 | /// The image is displayed within a rectangle.
16 | ///
17 | Default = 0,
18 |
19 | ///
20 | /// The image is displayed within a rectangle.
21 | ///
22 | [Obsolete("ImageStyle.Normal has been deprecated. Use ImageStyle.Default", false)]
23 | Normal = 0,
24 |
25 | ///
26 | /// The image is cropped to a circle, a common way to represent people photos.
27 | ///
28 | Person = 1
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveHorizontalAlignment.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls how elements are horizontally positioned within their container.
10 | ///
11 | [JsonConverter(typeof(StringEnumConverter), true)]
12 | public enum AdaptiveHorizontalAlignment
13 | {
14 | ///
15 | /// The element is left aligned
16 | ///
17 | Left,
18 |
19 | ///
20 | /// The element is centered inside its container
21 | ///
22 | Center,
23 |
24 | ///
25 | /// The element is right aligned
26 | ///
27 | Right,
28 |
29 | ///
30 | /// Stretch the actions to fit the containerhrit
31 | ///
32 | Stretch
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTextWeight.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls the weight of TextBock Elements
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveTextWeight
13 | {
14 | ///
15 | /// The default text weight
16 | ///
17 | Default = 0,
18 |
19 | ///
20 | /// The default text weight
21 | ///
22 | [Obsolete("TextWeight.Normal has been deprecated. Use TextWeight.Default", false)]
23 | Normal = 0,
24 |
25 | ///
26 | /// Lighter text (thinner stroke)
27 | ///
28 | Lighter = 1,
29 |
30 | ///
31 | /// Bolder text (wider stroke)
32 | ///
33 | Bolder = 2
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/FontStylesConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class FontTypesConfig
10 | {
11 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
12 | public FontStyleConfig Default { get; set; } = new FontStyleConfig();
13 |
14 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
15 | public FontStyleConfig Monospace { get; set; } = new FontStyleConfig();
16 |
17 | public FontStyleConfig GetFontType(AdaptiveFontType fontType)
18 | {
19 | switch (fontType)
20 | {
21 | case AdaptiveFontType.Monospace:
22 | return Monospace;
23 | case AdaptiveFontType.Default:
24 | default:
25 | return Default;
26 | }
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/LabelConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Properties which control rendering of input labels
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class LabelConfig
13 | {
14 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
15 | public InputLabelConfig RequiredInputs { get; set; } = new InputLabelConfig();
16 |
17 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public InputLabelConfig OptionalInputs { get; set; } = new InputLabelConfig();
19 |
20 | ///
21 | /// Specifies the spacing between the label and the input
22 | ///
23 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
24 | public AdaptiveSpacing InputSpacing { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveFactSet.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System.Collections.Generic;
4 | using System.Xml.Serialization;
5 | using Newtonsoft.Json;
6 |
7 | namespace AdaptiveCards
8 | {
9 | ///
10 | /// Represents the FactSet element.
11 | ///
12 | #if !NETSTANDARD1_3
13 | [XmlType(TypeName = AdaptiveFactSet.TypeName)]
14 | #endif
15 | public class AdaptiveFactSet : AdaptiveElement
16 | {
17 | ///
18 | public const string TypeName = "FactSet";
19 |
20 | ///
21 | #if !NETSTANDARD1_3
22 | [XmlIgnore]
23 | #endif
24 | public override string Type { get; set; } = TypeName;
25 |
26 | ///
27 | /// A collection of Facts to this FactSet contains.
28 | ///
29 | [JsonRequired]
30 | #if !NETSTANDARD1_3
31 | [XmlElement(Type = typeof(AdaptiveFact), ElementName = "Fact")]
32 | #endif
33 | public List Facts { get; set; } = new List();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Microsoft
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveShowCardAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using System.Xml.Serialization;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Represents the Action.ShowCard element.
10 | ///
11 | #if !NETSTANDARD1_3
12 | [XmlType(TypeName = AdaptiveShowCardAction.TypeName)]
13 | #endif
14 | public class AdaptiveShowCardAction : AdaptiveAction
15 | {
16 | ///
17 | public const string TypeName = "Action.ShowCard";
18 |
19 | ///
20 | #if !NETSTANDARD1_3
21 | [XmlIgnore]
22 | #endif
23 | public override string Type { get; set; } = TypeName;
24 |
25 | ///
26 | /// to show when the action is invoked.
27 | ///
28 | [JsonProperty(Required = Required.Always)]
29 | #if !NETSTANDARD1_3
30 | [XmlElement(typeof(AdaptiveCard), ElementName = AdaptiveCard.TypeName)]
31 | #endif
32 | public AdaptiveCard Card { get; set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveImageSize.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Controls the horizontal size (width) of element.
9 | ///
10 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
11 | public enum AdaptiveImageSize
12 | {
13 | ///
14 | /// The width of the element is optimally chosen depending on the space available in the element's container
15 | ///
16 | Auto,
17 |
18 | ///
19 | /// The width of the element adjusts to match that of its container
20 | ///
21 | Stretch,
22 |
23 | ///
24 | /// Small width
25 | ///
26 | Small,
27 |
28 | ///
29 | /// Medium width
30 | ///
31 | Medium,
32 |
33 | ///
34 | /// Large width
35 | ///
36 | Large
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/SyntaxHighlighting/JSON.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | true
12 | false
13 |
14 |
15 | "
16 | (?=:)
17 |
18 |
19 |
20 | (?<=:)\040"[^"]*
21 |
22 | "
23 |
24 | \b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
25 |
26 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/License.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2017 Microsoft Corp
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/MediaConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Properties which control rendering of media
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class MediaConfig
13 | {
14 | ///
15 | /// Default poster URL to use for media thumbnail
16 | ///
17 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public string DefaultPoster { get; set; }
19 |
20 | ///
21 | /// Play button URL to use for media thumbnail
22 | ///
23 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
24 | public string PlayButton { get; set; }
25 |
26 | ///
27 | /// Controls whether the media is played in the card or sent to host
28 | ///
29 | public bool AllowInlinePlayback { get; set; } = true;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/App.xaml.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Collections.Generic;
5 | using System.Configuration;
6 | using System.Data;
7 | using System.IO;
8 | using System.Linq;
9 | using System.Threading.Tasks;
10 | using System.Windows;
11 |
12 | namespace WpfVisualizer
13 | {
14 | ///
15 | /// Interaction logic for App.xaml
16 | ///
17 | public partial class App : Application
18 | {
19 | public App()
20 | {
21 | SetCurrentDirectory();
22 | }
23 |
24 | ///
25 | /// Sets the current directory to the app's output directory. This is needed for Desktop Bridge, which
26 | /// defaults to the Windows directory.
27 | ///
28 | private void SetCurrentDirectory()
29 | {
30 | // Gets the location of the EXE, including the EXE name
31 | var exePath = typeof(App).Assembly.Location;
32 | var outputDir = Path.GetDirectoryName(exePath);
33 | Directory.SetCurrentDirectory(outputDir);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/MarkedNet/MarkedNetLicense.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 Alex Titarenko, Christopher Jeffrey
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to find out which attributes exist for C# debugging
3 | // Use hover for the description of the existing attributes
4 | // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": ".NET Core Launch (console)",
9 | "type": "coreclr",
10 | "request": "launch",
11 | "preLaunchTask": "build",
12 | // If you have changed target frameworks, make sure to update the program path.
13 | "program": "${workspaceFolder}/Test/AdaptiveCards.Rendering.Html.Test/bin/Debug/netcoreapp1.1/AdaptiveCards.Rendering.Html.Test.dll",
14 | "args": [],
15 | "cwd": "${workspaceFolder}/Test/AdaptiveCards.Rendering.Html.Test",
16 | // For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
17 | "console": "internalConsole",
18 | "stopAtEntry": false,
19 | "internalConsoleOptions": "openOnSessionStart"
20 | },
21 | {
22 | "name": ".NET Core Attach",
23 | "type": "coreclr",
24 | "request": "attach",
25 | "processId": "${command:pickProcess}"
26 | }
27 | ]
28 | }
29 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTokenExchangeResource.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using System.Xml.Serialization;
5 |
6 | namespace AdaptiveCards
7 | {
8 | public class AdaptiveTokenExchangeResource
9 | {
10 | ///
11 | /// The unique identifier of this token exchange instance.
12 | ///
13 | [JsonRequired]
14 | #if !NETSTANDARD1_3
15 | [XmlAttribute]
16 | #endif
17 | public string Id { get; set; }
18 |
19 | ///
20 | /// An application ID or resource identifier with which to exchange a token on behalf of.
21 | /// This property is identity provider- and application-specific.
22 | ///
23 | [JsonRequired]
24 | #if !NETSTANDARD1_3
25 | [XmlAttribute]
26 | #endif
27 | public string Uri { get; set; }
28 |
29 | ///
30 | /// An identifier for the identity provider with which to attempt a token exchange.
31 | ///
32 | [JsonRequired]
33 | #if !NETSTANDARD1_3
34 | [XmlAttribute]
35 | #endif
36 | public string ProviderId { get; set; }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveToggleVisibilityAction.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using System.Collections.Generic;
5 | using System.Xml.Serialization;
6 |
7 | namespace AdaptiveCards
8 | {
9 | ///
10 | /// Represents the Action.ToggleVisibility element.
11 | ///
12 | #if !NETSTANDARD1_3
13 | [XmlType(TypeName = AdaptiveToggleVisibilityAction.TypeName)]
14 | #endif
15 | public class AdaptiveToggleVisibilityAction : AdaptiveAction
16 | {
17 | ///
18 | public const string TypeName = "Action.ToggleVisibility";
19 |
20 | ///
21 | #if !NETSTANDARD1_3
22 | [XmlIgnore]
23 | #endif
24 | public override string Type { get; set; } = TypeName;
25 |
26 | ///
27 | /// Ids of elements whose visibility this element should change.
28 | ///
29 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
30 | [JsonConverter(typeof(ToggleElementsConverter))]
31 | #if !NETSTANDARD1_3
32 | [XmlElement]
33 | #endif
34 | public List TargetElements { get; set; } = new List();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/ErrorMessageConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | ///
9 | /// Properties which control rendering of media
10 | ///
11 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
12 | public class ErrorMessageConfig
13 | {
14 | ///
15 | /// The text color of the label
16 | ///
17 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
18 | public AdaptiveSpacing Spacing { get; set; } = AdaptiveSpacing.Default;
19 |
20 | ///
21 | /// The text size of the label
22 | ///
23 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
24 | public AdaptiveTextSize Size { get; set; } = AdaptiveTextSize.Default;
25 |
26 | ///
27 | /// The text weight of the label
28 | ///
29 | [JsonProperty(DefaultValueHandling = DefaultValueHandling.Ignore)]
30 | public AdaptiveTextWeight Weight { get; set; } = AdaptiveTextWeight.Default;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveSpacing.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 |
5 | namespace AdaptiveCards
6 | {
7 | ///
8 | /// Controls the spacing of an element.
9 | ///
10 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
11 | public enum AdaptiveSpacing
12 | {
13 | ///
14 | /// Use the default spacing.
15 | ///
16 | Default,
17 |
18 | ///
19 | /// Use no spacing.
20 | ///
21 | None,
22 |
23 | ///
24 | /// Use small spacing.
25 | ///
26 | Small,
27 |
28 | ///
29 | /// Use medium spacing.
30 | ///
31 | Medium,
32 |
33 | ///
34 | /// Use large spacing.
35 | ///
36 | Large,
37 |
38 | ///
39 | /// Use extra large spacing.
40 | ///
41 | ExtraLarge,
42 |
43 | ///
44 | /// This results in the same padding that's applied to the card itself.
45 | ///
46 | Padding
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTextSize.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using Newtonsoft.Json;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Controls the relative size of TextBlock elements
10 | ///
11 | [JsonConverter(typeof(IgnoreDefaultStringEnumConverter), true)]
12 | public enum AdaptiveTextSize
13 | {
14 | ///
15 | /// Default text size
16 | ///
17 | Default = 0,
18 | ///
19 | /// Default text size
20 | ///
21 | [Obsolete("TextSize.Normal has been deprecated. Use Default", false)]
22 | Normal = 0,
23 |
24 | ///
25 | /// Smallest text size
26 | ///
27 | Small = 1,
28 |
29 | ///
30 | /// Slightly larger than default
31 | ///
32 | Medium = 2,
33 |
34 | ///
35 | /// Slightly larger then medium
36 | ///
37 | Large = 3,
38 |
39 | ///
40 | /// The largest text size
41 | ///
42 | ExtraLarge = 4
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Sample.ImageRender/README.md:
--------------------------------------------------------------------------------
1 | # AdaptiveCards Image Renderer Sample
2 |
3 | This provides a CLI to exercise the .NET WPF Renderer to render to images (`AdaptiveCards.Rendering.Wpf`)
4 |
5 | ## Usage
6 |
7 | If you cloned this repo, run the following command to generate HTML from the Scenario samples. The tool scans a directory for .json files that contain Adaptive Card payloads.
8 |
9 | ```console
10 | Usage: dotnet run [payload-path] [options]
11 | ```
12 |
13 | ```console
14 | $ dotnet run
15 | ```
16 |
17 | Or output to a specific directory
18 |
19 | ```console
20 | $ dotnet run -o ./out
21 | ```
22 |
23 |
24 | ### Arguments
25 |
26 | Name | Description
27 | ---|---
28 | path | The path that contains JSON card payloads
29 |
30 | ### Options
31 |
32 | Short | Long | Description
33 | ---|---|---
34 | -h |--help | Show help information
35 | -r |--recursive | Recurse the directory for all JSON files
36 | -o |--out | The directory to output the image(s) to
37 | -i | --supports-interactivity | Include actions and inputs in the output
38 | n/a | --host-config | Specify a host config file
39 |
40 | ## Example to use Windows Notification host config
41 |
42 | ```console
43 | dotnet run ../../../../samples -r -i -o ./out --host-config ../../../../samples/hostconfig/windows-notification.json
44 | ```
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/XamlUtilities.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | namespace AdaptiveCards.Rendering.Wpf
4 | {
5 |
6 | public class XamlUtilities
7 | {
8 | ///
9 | /// Get fallback text from the speech element
10 | ///
11 | ///
12 | ///
13 | public static string GetFallbackText(AdaptiveElement adaptiveElement)
14 | {
15 | #pragma warning disable CS0618 // Type or member is obsolete
16 | if (!string.IsNullOrEmpty(adaptiveElement.Speak))
17 | {
18 | var doc = new System.Xml.XmlDocument();
19 | var xml = adaptiveElement.Speak;
20 | if (!xml.Trim().StartsWith("<"))
21 | xml = $"\n{xml}";
22 | else if (!xml.StartsWith("\n{xml}";
24 | doc.LoadXml(xml);
25 | return doc.InnerText;
26 | }
27 | #pragma warning restore CS0618 // Type or member is obsolete
28 |
29 | return null;
30 | }
31 |
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/AdaptiveTextInputStyle.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Converters;
5 |
6 | namespace AdaptiveCards
7 | {
8 | ///
9 | /// Style of text input.
10 | ///
11 | [JsonConverter(typeof(StringEnumConverter), true)]
12 | public enum AdaptiveTextInputStyle
13 | {
14 | ///
15 | /// Unstructured plain text.
16 | ///
17 | Text,
18 |
19 | ///
20 | /// Input is a telephone number. The client may use this information to provide optimized keyboard input for the
21 | /// user.
22 | ///
23 | Tel,
24 |
25 | ///
26 | /// Input is a url. The client may use this information to provide optimized keyboard input for the user.
27 | ///
28 | Url,
29 |
30 | ///
31 | /// Input is an email address. The client may use this information to provide optimized keyboard input for the user.
32 | ///
33 | Email,
34 |
35 | ///
36 | /// Display input text with password masking
37 | ///
38 | Password,
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf.Core/AdaptiveCards.Rendering.Wpf.Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Library
5 | netcoreapp3.0
6 | true
7 |
8 | false
9 | AdaptiveCards.Rendering.Wpf.Core
10 | AdaptiveCards.Rendering.Wpf
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | MSBuild:Compile
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/Samples/AdaptiveCards.Core.Sample.ImageRender/README.md:
--------------------------------------------------------------------------------
1 | # AdaptiveCards Image Renderer Sample
2 |
3 | This provides a CLI to exercise the .NETCore Renderer to render to images (`AdaptiveCards.Rendering.Wpf.Core`)
4 |
5 | ## Usage
6 |
7 | If you cloned this repo, run the following command to generate images from the Scenario samples. The tool scans a directory for .json files that contain Adaptive Card payloads.
8 |
9 | ```console
10 | Usage: dotnet run [payload-path] [options]
11 | ```
12 |
13 | ```console
14 | $ dotnet run
15 | ```
16 |
17 | Or output to a specific directory
18 |
19 | ```console
20 | $ dotnet run -- -o ./out
21 | ```
22 |
23 |
24 | ### Arguments
25 |
26 | Name | Description
27 | ---|---
28 | path | The path that contains JSON card payloads
29 |
30 | ### Options
31 |
32 | Short | Long | Description
33 | ---|---|---
34 | -h |--help | Show help information
35 | -r |--recursive | Recurse the directory for all JSON files
36 | -o |--out | The directory to output the image(s) to
37 | -i | --supports-interactivity | Include actions and inputs in the output
38 | n/a | --host-config | Specify a host config file
39 |
40 | ## Example to use Windows Notification host config
41 |
42 | ```console
43 | dotnet run -- ../../../../samples -r -i -o ./out --host-config ../../../../samples/hostconfig/windows-notification.json
44 | ```
--------------------------------------------------------------------------------
/Samples/WPFVisualizer/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | //------------------------------------------------------------------------------
4 | //
5 | // This code was generated by a tool.
6 | // Runtime Version:4.0.30319.42000
7 | //
8 | // Changes to this file may cause incorrect behavior and will be lost if
9 | // the code is regenerated.
10 | //
11 | //------------------------------------------------------------------------------
12 |
13 | namespace WpfVisualizer.Properties
14 | {
15 |
16 |
17 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
18 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
19 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
20 | {
21 |
22 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
23 |
24 | public static Settings Default
25 | {
26 | get
27 | {
28 | return defaultInstance;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/RunAllTests.ps1:
--------------------------------------------------------------------------------
1 | Push-Location $PSScriptRoot
2 |
3 | # Disable our build versionning for the tests as it doesn't support .NETCore
4 | $env:XES_DISABLEMSBUILDVERSIONING ="True"
5 |
6 | $testResultsPath = New-Item -ErrorAction Ignore -ItemType directory -Path .\TestResults\$(get-date -f MM-dd-yyyy-HH-mm-ss)
7 | New-Item -ItemType directory $testResultsPath/HTML
8 | New-Item -ItemType directory $testResultsPath/WPF
9 |
10 | $samplesPath = "..\..\..\..\samples"
11 | $v1scenariosPath = $samplesPath + "\v1.0\scenarios"
12 |
13 | Write-Host Running unit tests...
14 | dotnet test .\test\AdaptiveCards.Test
15 |
16 | Write-Host Running WPF tests...
17 | Set-Location .\Samples\AdaptiveCards.Sample.ImageRender
18 |
19 | Write-Host SupportsInteractivity = false...
20 | dotnet run $v1scenariosPath -- -r -o $testResultsPath\WPF\StandardNonInteractive
21 |
22 | Write-Host SupportsInteractivity = true...
23 | dotnet run $v1scenariosPath -- -r -i -o $testResultsPath\WPF\Standard
24 |
25 | Write-Host Windows notification config....
26 | dotnet run $v1scenariosPath -- -r -o $testResultsPath\WPF\WindowsNotification --host-config $samplesPath\hostconfig\windows-notification.json
27 |
28 | Write-Host Timeline config...
29 | dotnet run $v1scenariosPath -- -r -o $testResultsPath\WPF\WindowsTimeline --host-config $samplesPath\hostconfig\windows-timeline.json
30 |
31 | Pop-Location
32 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards/Rendering/FactSetConfig.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using Newtonsoft.Json;
4 | using Newtonsoft.Json.Serialization;
5 |
6 | namespace AdaptiveCards.Rendering
7 | {
8 | [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
9 | public class FactSetConfig
10 | {
11 |
12 | ///
13 | /// TextBlock to use for Titles in factsets
14 | ///
15 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
16 | public TextBlockConfig Title { get; set; } = new TextBlockConfig() { Size = AdaptiveTextSize.Default, Color = AdaptiveTextColor.Default, IsSubtle = false, Weight = AdaptiveTextWeight.Bolder, Wrap = true, MaxWidth = 150 };
17 |
18 | ///
19 | /// TextBlock to use for Values in fact sets
20 | ///
21 | [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
22 | public TextBlockConfig Value { get; set; } = new TextBlockConfig() { Size = AdaptiveTextSize.Default, Color = AdaptiveTextColor.Default, IsSubtle = false, Weight = AdaptiveTextWeight.Default, Wrap = true };
23 |
24 | ///
25 | /// Spacing between facts and values
26 | ///
27 | public int Spacing { get; set; } = 10;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/AdaptiveDateInputRenderer.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 |
7 | namespace AdaptiveCards.Rendering.Wpf
8 | {
9 | public static class AdaptiveDateInputRenderer
10 | {
11 | public static FrameworkElement Render(AdaptiveDateInput input, AdaptiveRenderContext context)
12 | {
13 | var textBox = new TextBox() { Text = input.Value };
14 | textBox.SetPlaceholder(input.Placeholder);
15 | textBox.Style = context.GetStyle($"Adaptive.Input.Text.Date");
16 | textBox.SetContext(input);
17 |
18 | DateTime maxDate, minDate;
19 | if ((DateTime.TryParse(input.Max, out maxDate) || DateTime.TryParse(input.Min, out minDate) || input.IsRequired)
20 | && string.IsNullOrEmpty(input.ErrorMessage))
21 | {
22 | context.Warnings.Add(new AdaptiveWarning((int)AdaptiveWarning.WarningStatusCode.NoErrorMessageForValidatedInput,
23 | "Inputs with validation should include an ErrorMessage"));
24 | }
25 |
26 | context.InputValues.Add(input.Id, new AdaptiveDateInputValue(input, textBox));
27 |
28 | return textBox;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/AdaptiveTimeInputRenderer.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Windows;
5 | using System.Windows.Controls;
6 |
7 | namespace AdaptiveCards.Rendering.Wpf
8 | {
9 | public static class AdaptiveTimeInputRenderer
10 | {
11 | public static FrameworkElement Render(AdaptiveTimeInput input, AdaptiveRenderContext context)
12 | {
13 | var textBox = new TextBox() { Text = input.Value };
14 | textBox.SetPlaceholder(input.Placeholder);
15 | textBox.Style = context.GetStyle("Adaptive.Input.Text.Time");
16 | textBox.SetContext(input);
17 |
18 | TimeSpan maxTime, minTime;
19 | if ((TimeSpan.TryParse(input.Max, out maxTime) || TimeSpan.TryParse(input.Min, out minTime) || input.IsRequired)
20 | && string.IsNullOrEmpty(input.ErrorMessage))
21 | {
22 | context.Warnings.Add(new AdaptiveWarning((int)AdaptiveWarning.WarningStatusCode.NoErrorMessageForValidatedInput,
23 | "Inputs with validation should include an ErrorMessage"));
24 | }
25 |
26 | context.InputValues.Add(input.Id, new AdaptiveTimeInputValue(input, textBox));
27 |
28 | return textBox;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Library/AdaptiveCards.Rendering.Wpf/Helpers/TaskExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Microsoft Corporation. All rights reserved.
2 | // Licensed under the MIT License.
3 | using System;
4 | using System.Threading;
5 | using System.Threading.Tasks;
6 |
7 | namespace AdaptiveCards.Rendering.Wpf
8 | {
9 | public static class TaskExtensions
10 | {
11 | private static readonly TaskScheduler _staScheduler = new StaTaskScheduler(1); //numberOfThreads: Environment.ProcessorCount);
12 |
13 | ///
14 | /// Starts a new STA thread. This is necessary for rendering WPF to bitmaps from a console app or server
15 | ///
16 | public static Task StartNewSta(this TaskFactory factory, Func action)
17 | {
18 | return factory.StartNew(action, CancellationToken.None, TaskCreationOptions.None, _staScheduler);
19 | }
20 |
21 | public static async Task WithCancellation(this Task task, CancellationToken cancellationToken)
22 | {
23 | var tcs = new TaskCompletionSource