Ejemplo n.º 1
0
        private async void ExecuteSpeedTest(SpeedTestSource source, Server server = null)
        {
            try
            {
                SpeedGrid.IsEnabled = false;

                DownloadSpeed speed = null;

                if (source == SpeedTestSource.Speedtest)
                {
                    speed = await SpeedTestClient.GetDownloadSpeed(server, SpeedTestUnit.KiloBitsPerSecond);
                }
                else
                {
                    speed = await FastClient.GetDownloadSpeed(SpeedTestUnit.KiloBitsPerSecond);
                }

                var message = $"Source: {speed.Source} Download Speed: {speed?.Speed} {speed.Unit}";

                if (speed?.Server?.Id != null)
                {
                    message += $" (Server Id = {speed?.Server?.Id})";
                }

                ShowMessage(message);
                SpeedGrid.IsEnabled = true;
            }
            catch (System.Exception ex)
            {
                ShowMessage(ex.Message);
                SpeedGrid.IsEnabled = true;
            }
        }
Ejemplo n.º 2
0
        internal static string ToSourceString(this SpeedTestSource source)
        {
            if (source == SpeedTestSource.Fast)
            {
                return("fast.com");
            }

            return("speedtest.net");
        }