private void RefreshStatistics() { asyncDatabaseCommands .GetStatisticsAsync() .ContinueOnSuccess(stats => { Statistics.Value = stats; }); }
private void RefreshStatistics() { asyncDatabaseCommands .GetStatisticsAsync() .ContinueOnSuccess(stats => { Statistics.Value = stats; Status.Value = "Online"; // ApplicationModel.Current.Server.Value.IsConnected.Value = true; }) .Catch(exception => { Status.Value = "Offline"; // ApplicationModel.Current.Server.Value.IsConnected.Value = false; }); }
protected bool WaitForIndexToReplicate(IAsyncDatabaseCommands commands, string indexName, int timeoutInMilliseconds = 1500) { var mre = new ManualResetEventSlim(); hasWaitEnded = false; Task.Run(async() => { while (hasWaitEnded == false) { var stats = await commands.GetStatisticsAsync().ConfigureAwait(false); if (stats.Indexes.Any(x => x.Name == indexName)) { mre.Set(); break; } Thread.Sleep(25); } }); var success = mre.Wait(timeoutInMilliseconds); hasWaitEnded = true; return(success); }
protected override Task <DatabaseStatistics> GetStats() { return(commands.GetStatisticsAsync()); }
public override Task TimerTickedAsync() { return(asyncDatabaseCommands .GetStatisticsAsync() .ContinueOnSuccess(stats => Statistics.Value = stats)); }
private Task RefreshStatistics() { return(asyncDatabaseCommands .GetStatisticsAsync() .ContinueOnSuccessInTheUIThread(s => Statistics.Value = s)); }