Exemplo n.º 1
0
        // 綁定Adaptive Card的資料
        public static AdaptiveCard BindData(this AdaptiveCard card, JObject data)
        {
            if (data == null)
            {
                return(card);
            }

            return(card.BindData(data.ToObject <Dictionary <string, object> >()));
        }
Exemplo n.º 2
0
        // 綁定Adaptive Card的資料
        public static AdaptiveCard BindData <T>(this AdaptiveCard card, T data)
        {
            if (data == null)
            {
                return(card);
            }
            var dictionaryData = data.GetType()
                                 .GetProperties(BindingFlags.Instance | BindingFlags.Public)
                                 .ToDictionary(prop => prop.Name, prop => prop.GetValue(data, null));

            return(card.BindData(dictionaryData));
        }