async Task Ping()
        {
            Animation ellipsisAnimation = new Animation(t => PingStatus.Text = "waiting" + new string('.', (int)(t * 4)));

            PingStatus.Text = "waiting";
            PingStatus.Animate("Ellipsis", ellipsisAnimation, 200, 800, null, null, () => true);

            bool success = await DataService.Instance.PingServerAsync();

            PingStatus.AbortAnimation("Ellipsis");
            PingStatus.Text      = success ? "OK" : "Failed";
            PingStatus.TextColor = success ? Color.Green : Color.Red;
        }
Example #2
0
        // Copied over from ServerConfigPage
        async Task Ping()
        {
            Animation ellipsisAnimation = new Animation(t => PingStatus.Text = "waiting" + new string('.', (int)(t * 4)));

            PingStatus.Text = "waiting";
            PingStatus.Animate("Ellipsis", ellipsisAnimation, 200, 800, null, null, () => true);

            bool success = await DataService.Instance.PingServerAsync();

            PingStatus.AbortAnimation("Ellipsis");
            PingStatus.Text      = success ? "OK" : "Failed";
            PingStatus.TextColor = success ? Color.Green : Color.Red;

            // This triggers the App to recheck the server address, so the text
            // under PingStatus is somewhat synchronized with the IsServerAddressGood
            // property. It is mostly a quick hack to avoid a possible headscratcher.
            App.Current.ServerAddress = App.Current.ServerAddress;
        }