protected override async Task LoadDataOverride()
{
try
{
_instancesPerZone = null;
_instancesPerZone = await _dataSource.Value.GetAllInstancesPerZonesAsync();
PresentViewModels();
EventsReporterWrapper.ReportEvent(GceVMsLoadedEvent.Create(CommandStatus.Success));
}
catch (DataSourceException ex)
{
var innerEx = ex.InnerException as GoogleApiException;
if (innerEx != null && innerEx.HttpStatusCode == System.Net.HttpStatusCode.Forbidden)
{
Debug.WriteLine("The GCE API is not enabled.");
// Show the node that notifies users that the API is disabled.
Children.Clear();
Children.Add(new DisabledApiWarning(
apiName: ComputeApiName,
caption: Resources.CloudExplorerGceSourceApiDisabledMessage,
project: Context.CurrentProject));
return;
}
EventsReporterWrapper.ReportEvent(GceVMsLoadedEvent.Create(CommandStatus.Failure));
throw new CloudExplorerSourceException(ex.Message, ex);
}
}