コード例 #1
0
        public IAsyncOperation <StorageResult> destroyDbFileAndKeychain(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);

                    string username = paramStrings[0];
                    // destroy the db
                    JSONStore.destroyData(username);
                    return new StorageResult(Status.OK, JSONStoreConstants.JSON_STORE_RC_OK);
                }
                catch (JSONStoreException jsonException)
                {
                    // 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)));
        }