Beispiel #1
0
        private void renderAdaptiveCard(string jsonText, bool showErrorToast)
        {
            try
            {
                AdaptiveCard adaptiveCard = AdaptiveCard.DeserializeFromString(jsonText, AdaptiveCardRenderer.Version);
                Toast.MakeText(this, adaptiveCard.Body.Capacity().ToString(), ToastLength.Short).Show();
                LinearLayout layout = (LinearLayout)FindViewById(Resource.Id.visualAdaptiveCardLayout);
                layout.RemoveAllViews();

                var renderedCard = AdaptiveCardRenderer.Instance.Render(Application.Context, SupportFragmentManager, adaptiveCard, this, new HostConfig());
                layout.AddView(renderedCard.View);
            }
            catch (Java.IO.IOException ex)
            {
                if (showErrorToast)
                {
                    Toast.MakeText(this, ex.Message, ToastLength.Short).Show();
                }
            }
        }