public Task ClearCurrentConfigAsync() { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = null; AVClient.ApplicationSettings.Remove(CurrentConfigKey); }), CancellationToken.None)); }
public Task <AVConfig> GetCurrentConfigAsync() { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { if (currentConfig == null) { return storageController.LoadAsync().OnSuccess(t => { object tmp; t.Result.TryGetValue(CurrentConfigKey, out tmp); string propertiesString = tmp as string; if (propertiesString != null) { var dictionary = AVClient.DeserializeJsonString(propertiesString); currentConfig = new AVConfig(dictionary); } else { currentConfig = new AVConfig(); } return currentConfig; }); } return Task.FromResult(currentConfig); }), CancellationToken.None).Unwrap()); }
public Task TestGetConfig() { return(AVConfig.GetAsync().ContinueWith(t => { Assert.AreEqual("testValue", t.Result["testKey"]); Assert.AreEqual("testValue", t.Result.Get <string>("testKey")); })); }
public void TestCurrentConfig() { AVConfig config = AVConfig.CurrentConfig; Assert.AreEqual("testValue", config["testKey"]); Assert.AreEqual("testValue", config.Get <string>("testKey")); }
public Task ClearCurrentConfigAsync() { return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = null; return storageController.LoadAsync().OnSuccess(t => t.Result.RemoveAsync(CurrentConfigKey)); }).Unwrap().Unwrap(), CancellationToken.None); }
public Task ClearCurrentConfigAsync() { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = null; return storageController.LoadAsync().OnSuccess(t => t.Result.RemoveAsync(CurrentConfigKey)); }).Unwrap().Unwrap(), CancellationToken.None)); }
public Task TestGetConfigCancel() { CancellationTokenSource tokenSource = new CancellationTokenSource(); tokenSource.Cancel(); return(AVConfig.GetAsync(tokenSource.Token).ContinueWith(t => { Assert.True(t.IsCanceled); })); }
public Task SetCurrentConfigAsync(AVConfig config) { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = config; var jsonObject = ((IJsonConvertible)config).ToJSON(); var jsonString = AVClient.SerializeJsonString(jsonObject); AVClient.ApplicationSettings[CurrentConfigKey] = jsonString; }), CancellationToken.None)); }
public Task SetCurrentConfigAsync(AVConfig config) { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = config; var jsonObject = ((IJsonConvertible)config).ToJSON(); var jsonString = AVClient.SerializeJsonString(jsonObject); return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString)); }).Unwrap().Unwrap(), CancellationToken.None)); }
public void TestToJSON() { AVConfig config1 = AVConfig.CurrentConfig; IDictionary <string, object> expectedJson = new Dictionary <string, object> { { "params", new Dictionary <string, object> { { "testKey", "testValue" } } } }; Assert.AreEqual(((IJsonConvertible)config1).ToJSON(), expectedJson); }
public Task<AVConfig> GetCurrentConfigAsync() { return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { if (currentConfig == null) { return storageController.LoadAsync().OnSuccess(t => { object tmp; t.Result.TryGetValue(CurrentConfigKey, out tmp); string propertiesString = tmp as string; if (propertiesString != null) { var dictionary = AVClient.DeserializeJsonString(propertiesString); currentConfig = new AVConfig(dictionary); } else { currentConfig = new AVConfig(); } return currentConfig; }); } return Task.FromResult(currentConfig); }), CancellationToken.None).Unwrap(); }
public Task <AVConfig> GetCurrentConfigAsync() { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { if (currentConfig == null) { object tmp; AVClient.ApplicationSettings.TryGetValue(CurrentConfigKey, out tmp); string propertiesString = tmp as string; if (propertiesString != null) { var dictionary = AVClient.DeserializeJsonString(propertiesString); currentConfig = new AVConfig(dictionary); } else { currentConfig = new AVConfig(); } } return currentConfig; }), CancellationToken.None)); }
public Task SetCurrentConfigAsync(AVConfig config) { return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = config; var jsonObject = ((IJsonConvertible)config).ToJSON(); var jsonString = AVClient.SerializeJsonString(jsonObject); return storageController.LoadAsync().OnSuccess(t => t.Result.AddAsync(CurrentConfigKey, jsonString)); }).Unwrap().Unwrap(), CancellationToken.None); }
public Task ClearCurrentConfigInMemoryAsync() { return taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = null; }), CancellationToken.None); }
public Task ClearCurrentConfigInMemoryAsync() { return(taskQueue.Enqueue(toAwait => toAwait.ContinueWith(_ => { currentConfig = null; }), CancellationToken.None)); }