public UIElement Render(IAdaptiveActionElement action, AdaptiveRenderContext context, AdaptiveRenderArgs renderArgs) { RadioButton submitActionRadioButton = new RadioButton(); submitActionRadioButton.Name = "SubmitActionRadioButton"; return(submitActionRadioButton); }
public UIElement Render(IAdaptiveActionElement action, AdaptiveRenderContext context, AdaptiveRenderArgs renderArgs) { RadioButton customActionRadioButton = new RadioButton(); customActionRadioButton.Name = "CustomActionRadioButton"; return(customActionRadioButton); }
public IAdaptiveActionElement FromJson(JsonObject inputJson, AdaptiveElementParserRegistration elementParsers, AdaptiveActionParserRegistration actionParsers, IList <AdaptiveWarning> warnings) { JsonObject jsonSubmitAction = inputJson.GetNamedObject("internalSubmitAction"); var submitActionParser = actionParsers.Get("Action.Submit"); IAdaptiveActionElement submitAction = submitActionParser.FromJson(jsonSubmitAction, elementParsers, actionParsers, warnings); return(new TestCustomAction(submitAction) as IAdaptiveActionElement); }
public void ValidateBaseActionProperties( IAdaptiveActionElement element, string iconUrl, string id, string title, string style) { Assert.AreEqual(iconUrl, element.IconUrl); Assert.AreEqual(id, element.Id); Assert.AreEqual(style, element.Style); Assert.AreEqual(title, element.Title); }
public void ActionParserRegistraton_CustomActionTest() { AdaptiveActionParserRegistration actionParserRegistration = new AdaptiveActionParserRegistration(); AdaptiveElementParserRegistration elementParserRegistration = new AdaptiveElementParserRegistration(); List <AdaptiveWarning> warnings = new List <AdaptiveWarning>(); actionParserRegistration.Set("TestCustomAction", new TestActionParser()); IAdaptiveActionParser testActionParserRetrieved = actionParserRegistration.Get("TestCustomAction"); Assert.IsNotNull(testActionParserRetrieved); Assert.IsNotNull(testActionParserRetrieved as TestActionParser); String testCard = "{" + " \"type\":\"AdaptiveCard\"," + " \"version\":\"1.0\"," + " \"body\":" + " [" + " ]," + " \"actions\":" + " [" + " {" + " \"type\":\"TestCustomAction\"," + " \"internalSubmitAction\":" + " {" + " \"type\": \"Action.Submit\"" + " }" + " }" + " ]" + "}"; AdaptiveCard card = AdaptiveCard.FromJsonString(testCard, elementParserRegistration, actionParserRegistration).AdaptiveCard; Assert.IsNotNull(card); Assert.AreEqual(1, card.Actions.Count); IAdaptiveActionElement action = card.Actions[0]; Assert.IsNotNull(action); Assert.AreEqual(ActionType.Custom, action.ActionType); Assert.AreEqual("TestCustomAction", action.ActionTypeString); TestCustomAction customElement = card.Actions[0] as TestCustomAction; Assert.IsNotNull(customElement); Assert.AreEqual(ActionType.Submit, customElement.InternalSubmitAction.ActionType); }
public TestCustomAction(IAdaptiveActionElement internalSubmitAction) { InternalSubmitAction = internalSubmitAction; }