コード例 #1
0
        public IAsyncOperation <StorageResult> startTransaction(string parameters)
        {
            return(AsyncInfo.Run((token) =>
                                 Task.Run <StorageResult>(() =>
            {
                try
                {
                    // deserialize the parameters passed in as an array of strings
                    string[] paramStrings = JsonConvert.DeserializeObject <string[]>(parameters);

                    //start the transaction
                    bool worked = JSONStore.startTransaction();
                    int rc = worked ? JSONStoreConstants.JSON_STORE_RC_OK : JSONStoreConstants.JSON_STORE_PERSISTENT_STORE_FAILURE;
                    return new StorageResult(Status.OK, rc);
                }
                catch (JSONStoreException jsonException)
                {
                    //JSONStoreLoggerException(exception);

                    // catch a JSONStore specific exception and return the error code
                    return new StorageResult(Status.ERROR, jsonException.errorCode);
                }
                catch (Exception)
                {
                    return new StorageResult(Status.ERROR, JSONStoreConstants.JSON_STORE_PERSISTENT_STORE_FAILURE);
                }
            }, token)));
        }