private async void sendDataToAPI()
    {
        Task <Response>[] updateSelectedFoodTasks = foodHandler.updateSelectedFood();
        Task <Response>[] postSelectedFoodTasks   = foodHandler.postSelectedFood();
        Task <Response>[] postCookedFoodTasks     = foodHandler.postCookedFood();
        Task <Response>[] sendEndSessionTasks     = foodHandler.updateEndSession();

        Task <Response>[] allTasks = updateSelectedFoodTasks
                                     .Concat(postSelectedFoodTasks)
                                     .Concat(postCookedFoodTasks)
                                     .Concat(sendEndSessionTasks)
                                     .ToArray();

        await Task.WhenAll(allTasks);
    }
예제 #2
0
    private async Task sendDataToAPI()
    {
        // update selected food
        Task <Response>[] updateSelectedFoodTasks = foodHandler.updateSelectedFood();
        // post selected food
        Task <Response>[] postSelectedFoodTasks = foodHandler.postSelectedFood();

        // update inBlenderFood
        Task <Response>[] updateInBlenderFoodsTasks = foodHandler.updateInBlenderFood();

        // post inBlenderFood
        Task <Response>[] postInBlenderFoodsTasks = foodHandler.postInBlenderFood();

        Task <Response>[] allTasks = updateSelectedFoodTasks
                                     .Concat(postSelectedFoodTasks)
                                     .Concat(updateInBlenderFoodsTasks)
                                     .Concat(postInBlenderFoodsTasks)
                                     .ToArray();

        await Task.WhenAll(allTasks);
    }