Example #1
0
            /**
             * send the the contents of the server response at the "execute" method of our DBXCallback class
             * @param json the contents of the server response
             */
            private void invokeEvent(JObject json)
            {
                TJSONArray arr        = new TJSONArray(json.Value <JArray>("invoke"));
                String     callbackID = arr.getAsJsonString(0).getValue();

                arr.remove(0);
                DBXCallback cb = callbacks[callbackID];

                if (cb != null)
                {
                    cb.Execute(arr.get(0), Convert.ToInt32(arr.getInt(1).Value));
                }
                else
                {
                    throw new DBXException("Invalid callback response");
                }
            }
Example #2
0
            private void broadcastEvent(JObject json)
            {
                List <string> keys = new List <string>(callbacks.Keys);
                TJSONArray    arr  = new TJSONArray(json.Value <JArray>("broadcast"));

                foreach (String callbackskeys in keys)
                {
                    DBXCallback cb = callbacks[callbackskeys];
                    if (cb != null)
                    {
                        cb.Execute(arr.get(0), Convert.ToInt32(arr.getInt(1).Value));
                    }
                    else
                    {
                        throw new DBXException("Invalid callback response");
                    }
                }
            }