public override RequestConnectionData Execute()
        {
            try
            {
                string result = null;
                if (RequestData != null)
                {
                    //     string serializedData = JsonConvert.SerializeObject(ConnReq);

                    /*
                     * var settings = new JsonSerializerSettings
                     * {
                     *  Error = (sender, args) =>
                     *  {
                     *      if (System.Diagnostics.Debugger.IsAttached)
                     *      {
                     *          System.Diagnostics.Debugger.Break();
                     *      }
                     *  }
                     * };*/

                    string serializedData = JsonConvert.SerializeObject(RequestData);

                    result = KinveyWebClient.PostStringAsync(QueryBuilder.Instance.GetPostRequestConnectionKinveyQuery(), serializedData).Result;
                }
                else
                {
                    string serializedData = JsonConvert.SerializeObject(AcceptData);

                    if (string.IsNullOrEmpty(RequestId))
                    {
                        result = KinveyWebClient.PostStringAsync(QueryBuilder.Instance.GetPostRequestConnectionKinveyQuery(), serializedData).Result;
                    }
                    else
                    {
                        string query = QueryBuilder.Instance.GetPostRequestConnectionKinveyQuery(RequestId);
                        AppProvider.Log.WriteLine(LogChannel.All, query + " " + serializedData);
                        result = KinveyWebClient.PutStringAsync(query, serializedData).Result;
                    }
                }
                ConnectRequest        ResultConnReq = JsonConvert.DeserializeObject <ConnectRequest>(result);
                RequestConnectionData resultRCD     = JsonConvert.DeserializeObject <RequestConnectionData>(result);
                AppProvider.Log.WriteLine(LogChannel.All, result);
                return(resultRCD);
            }
            catch (Exception ex)
            {
                AppProvider.Log.WriteLine(LogChannel.Exception, ex);
                Exception = ex;
            }

            return(null);
        }
Example #2
0
        public override T Execute()
        {
            try
            {
                string serializedData = JsonConvert.SerializeObject(Data);
                string result         = null;

                AppProvider.Log.WriteLine(LogChannel.All, Query + ":" + serializedData);

                try
                {
                    if (IsPostQuery)
                    {
                        result = KinveyWebClient.PostStringAsync(Query, serializedData).Result;
                    }
                    //result = WebClient.PostStringAsync(Query, serializedData).Result;
                    else
                    {
                        result = KinveyWebClient.PutStringAsync(Query, serializedData).Result;
                    }
                }
                catch (Exception ex)
                {
                    AppProvider.Log.WriteLine(LogChannel.All, ex);
                }

                AppProvider.Log.WriteLine(LogChannel.All, result);
                Result = JsonConvert.DeserializeObject <T>(result);

                OnResult(Result);
                return(Result);
            }
            catch (Exception ex)
            {
                AppProvider.Log.WriteLine(LogChannel.Exception, ex);
                Exception = ex;
            }

            return(null);
        }