コード例 #1
0
        internal void Send(JsonRPCFuture future, out Task <IPremiseObject> task)
        {
            _futures[future.id] = future;

            task = Task.Run(
                () =>
            {
                string strMessage = JsonConvert.SerializeObject(future);
                base.Send(strMessage);

                dynamic result;
                try
                {
                    result = future.Await();
                }
                catch (Exception ex)
                {
                    OnError(ex);
                    return(null);
                }

                var premiseObject = new PremiseObject(this, (string)result);
                return((IPremiseObject)premiseObject);
            });
        }
コード例 #2
0
        internal void Send(JsonRPCFuture future, out Task <IPremiseObjectCollection> task)
        {
            _futures[future.id] = future;

            task = Task.Run(
                () =>
            {
                string strMessage = JsonConvert.SerializeObject(future);
                base.Send(strMessage);

                JArray result;
                try
                {
                    result = future.Await() as JArray;
                }
                catch (Exception ex)
                {
                    OnError(ex);
                    return(null);
                }
                var premiseObjects = new List <IPremiseObject>();
                if (result == null)
                {
                    return(null);
                }
                foreach (var item in result)
                {
                    var premiseObject = new PremiseObject(this, (string)item);
                    premiseObjects.Add(premiseObject);
                }
                var collection = (IPremiseObjectCollection)premiseObjects;
                return(collection);
            });
        }
コード例 #3
0
        IPremiseObject IPremiseObject.WrapObjectId(string objectId)
        {
            var premiseObject = new PremiseObject(_client, objectId);

            return(premiseObject);
        }