Esempio n. 1
0
 private void RefreshStatistics()
 {
     asyncDatabaseCommands
     .GetStatisticsAsync()
     .ContinueOnSuccess(stats =>
     {
         Statistics.Value = stats;
     });
 }
Esempio n. 2
0
 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;
     });
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
 protected override Task <DatabaseStatistics> GetStats()
 {
     return(commands.GetStatisticsAsync());
 }
Esempio n. 5
0
 public override Task TimerTickedAsync()
 {
     return(asyncDatabaseCommands
            .GetStatisticsAsync()
            .ContinueOnSuccess(stats => Statistics.Value = stats));
 }
Esempio n. 6
0
 private Task RefreshStatistics()
 {
     return(asyncDatabaseCommands
            .GetStatisticsAsync()
            .ContinueOnSuccessInTheUIThread(s => Statistics.Value = s));
 }