private async Task <bool> ValidateGcpProject()
        {
            // Reset UI state.
            CanPublish      = true;
            NeedsApiEnabled = false;

            if (!await CurrentApiManager.AreServicesEnabledAsync(s_requiredApis))
            {
                CanPublish      = false;
                NeedsApiEnabled = true;
                return(false);
            }
            return(true);
        }
        private async Task <bool> ValidateGcpProjectState()
        {
            // Reset UI state.
            CanPublish      = true;
            NeedsApiEnabled = false;
            RefreshClustersListCommand.CanExecuteCommand = true;
            CreateClusterCommand.CanExecuteCommand       = true;

            if (!await CurrentApiManager.AreServicesEnabledAsync(s_requiredApis))
            {
                CanPublish      = false;
                NeedsApiEnabled = true;
                RefreshClustersListCommand.CanExecuteCommand = false;
                CreateClusterCommand.CanExecuteCommand       = false;
                return(false);
            }
            return(true);
        }
        private async Task ValidateGcpProjectState()
        {
            try
            {
                // Go into loading mode.
                LoadingProject = true;

                // Clean slate for the messages.
                CanPublish      = true;
                NeedsApiEnabled = false;
                NeedsAppCreated = false;
                GeneralError    = false;

                // Ensure the necessary APIs are enabled.
                if (!await CurrentApiManager.AreServicesEnabledAsync(s_requiredApis))
                {
                    Debug.WriteLine("The user refused to enable the APIs for GAE.");
                    CanPublish      = false;
                    NeedsApiEnabled = true;
                    return;
                }

                // Using the GAE API, check if there's an app for the project.
                Google.Apis.Appengine.v1.Data.Application app = await CurrentDataSource.GetApplicationAsync();

                if (app == null)
                {
                    CanPublish      = false;
                    NeedsAppCreated = true;
                    return;
                }
            }
            catch (Exception ex) when(!ErrorHandlerUtils.IsCriticalException(ex))
            {
                CanPublish   = false;
                GeneralError = true;
            }
            finally
            {
                LoadingProject = false;
            }
        }