コード例 #1
0
 public DweetEventArgs(Dweet dweet)
 {
     Dweet = dweet;
 }
コード例 #2
0
        protected void HandleDweet(Dweet dweet)
        {
            if (isReady())
            {
                // The NodeRED dweetio node returns the dweet contents
                // wrapped in a payload object so detect this and
                // unwrap the value

                var content = dweet.Content.IsPayloadObject()
                    ? dweet.Content.As<PayloadEntity>().Payload
                    : dweet.Content;

                var entity = content.As<Entity>();
                if (entity != null)
                {
                    switch (entity.Type)
                    {
                        case EntityType.Action:
                            var action = content.As<ActionEntity>();
                            HandleAction(action);
                            break;
                    }
                }
                else
                {
                    LogUtil.Warning("Received dweet is not a valid entity.");
                }
            }
        }