Esempio n. 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="richMenuId">
 /// Rich menu ID
 /// </param>
 /// <param name="source">
 /// Rich menu object
 /// </param>
 public ResponseRichMenu(string richMenuId, RichMenu source)
 {
     RichMenuId  = richMenuId;
     Size        = source.Size;
     Selected    = source.Selected;
     Name        = source.Name;
     ChatBarText = source.ChatBarText;
     Areas       = source.Areas;
 }
Esempio n. 2
0
        internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
        {
            var areas = new List <ActionArea>();

            foreach (var area in dynamicObject?.areas ?? Enumerable.Empty <dynamic>())
            {
                areas.Add(ActionArea.CreateFrom(area));
            }

            var menu = new RichMenu()
            {
                Name        = (string)dynamicObject?.name,
                Size        = new ImageSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
                Selected    = (bool)(dynamicObject?.selected ?? false),
                ChatBarText = (string)dynamicObject?.chatBarText,
                Areas       = areas
            };

            return(new ResponseRichMenu((string)dynamicObject?.richMenuId, menu));
        }