示例#1
0
        async void getResponse(string[] args)
        {
            try
            {
                Task <byte[]> getResponseTask = client.GetByteArrayAsync("?jsonText=true");

                anotherTask(getResponseTask);

                byte[] response = await getResponseTask;
                handleResponse(Encoding.UTF8.GetString(response), args);
            }
            catch (HttpRequestException e)
            {
                if (e.InnerException is WebException)
                {
                    dManager.manageDialogueWeatherConnectionErrors("web exception", "das senhas académicas");
                }
            }
            catch (TaskCanceledException e)
            {
                dManager.manageDialogueWeatherConnectionErrors("timeout", "das senhas académicas");
            }
        }
示例#2
0
        async void getResponse(string[] args)
        {
            try
            {
                Task <string> getResponseTask = client.GetStringAsync("");

                anotherTask(getResponseTask);

                string response = await getResponseTask;
                handleResponse(response, args);
            }
            catch (HttpRequestException e)
            {
                if (e.InnerException is WebException)
                {
                    dManager.manageDialogueWeatherConnectionErrors("web exception", "dos parques de estacionamento");
                }
            }
            catch (TaskCanceledException e)
            {
                dManager.manageDialogueWeatherConnectionErrors("timeout", "dos parques de estacionamento");
            }
        }