private void OnAction(RenderedAdaptiveCard sender, AdaptiveActionEventArgs e) { if (e.Action is AdaptiveOpenUrlAction openUrlAction) { Process.Start(openUrlAction.Url.AbsoluteUri); } else if (e.Action is AdaptiveShowCardAction showCardAction) { // Action.ShowCard can be rendered inline automatically, or in "popup" mode // If the Host Config is set to Popup mode, then the app needs to show it if (Renderer.HostConfig.Actions.ShowCard.ActionMode == ShowCardActionMode.Popup) { var dialog = new ShowCardWindow(showCardAction.Title, showCardAction, Resources); dialog.Owner = this; dialog.ShowDialog(); } } else if (e.Action is AdaptiveSubmitAction submitAction) { var inputs = sender.UserInputs.AsJson(); // Merge the Action.Submit Data property with the inputs inputs.Merge(submitAction.Data); MessageBox.Show(this, JsonConvert.SerializeObject(inputs, Formatting.Indented), "SubmitAction"); } }
private void _onAction(object sender, ActionEventArgs e) { if (e.Action is AC.OpenUrlAction) { AC.OpenUrlAction action = (AC.OpenUrlAction)e.Action; Process.Start(action.Url); } else if (e.Action is AC.ShowCardAction) { ShowCardAction action = (AC.ShowCardAction)e.Action; if (HostConfig.Actions.ShowCard.ActionMode == AC.Rendering.Config.ShowCardActionMode.Popup) { ShowCardWindow dialog = new ShowCardWindow(action.Title, action, this.Resources); dialog.Owner = this; dialog.ShowDialog(); } } else if (e.Action is AC.SubmitAction) { AC.SubmitAction action = (AC.SubmitAction)e.Action; System.Windows.MessageBox.Show(this, JsonConvert.SerializeObject(e.Data, Newtonsoft.Json.Formatting.Indented), "SubmitAction"); } else if (e.Action is AC.HttpAction) { AC.HttpAction action = (AC.HttpAction)e.Action; StringBuilder sb = new StringBuilder(); sb.AppendLine($"HEADERS={JsonConvert.SerializeObject(action.Headers)}"); sb.AppendLine($"BODY={action.Body}"); sb.AppendLine($"DATA={e.Data}"); System.Windows.MessageBox.Show(this, sb.ToString(), $"HttpAction {action.Method} {action.Url}"); } }
private void OnAction(RenderedAdaptiveCard sender, AdaptiveActionEventArgs e) { if (e.Action is AdaptiveOpenUrlAction openUrlAction) { Process.Start(openUrlAction.Url); } else if (e.Action is AdaptiveShowCardAction showCardAction) { if (Renderer.HostConfig.Actions.ShowCard.ActionMode == ShowCardActionMode.Popup) { var dialog = new ShowCardWindow(showCardAction.Title, showCardAction, Resources); dialog.Owner = this; dialog.ShowDialog(); } } else if (e.Action is AdaptiveSubmitAction submitAction) { var inputs = sender.UserInputs.AsJson(); inputs.Merge(submitAction.Data); MessageBox.Show(this, JsonConvert.SerializeObject(inputs, Formatting.Indented), "SubmitAction"); } }
private void _onAction(object sender, ActionEventArgs e) { if (e.Action is AC.OpenUrlAction) { AC.OpenUrlAction action = (AC.OpenUrlAction)e.Action; Process.Start(action.Url); } else if (e.Action is AC.ShowCardAction) { ShowCardAction action = (AC.ShowCardAction)e.Action; if (HostConfig.Actions.ShowCard.ActionMode == AC.Rendering.Config.ShowCardActionMode.Popup) { ShowCardWindow dialog = new ShowCardWindow(action.Title, action, this.Resources); dialog.Owner = this; dialog.ShowDialog(); } } else if (e.Action is AC.SubmitAction) { AC.SubmitAction action = (AC.SubmitAction)e.Action; System.Windows.MessageBox.Show(this, JsonConvert.SerializeObject(e.Data, Newtonsoft.Json.Formatting.Indented), "SubmitAction"); } }