///////////////////////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////////////////////// async void Authenticate() { var tokenResult = await _viewDataClient.AuthenticateAsync(); if (!tokenResult.IsOk()) { _logger.LogError( "Authentication failed: " + tokenResult.Error.Reason); return; } _logger.LogMessage("Login successful :)"); _logger.LogMessage("Access Token: " + tokenResult.AccessToken, false); _logger.LogMessage("Expiration Time (sec): " + tokenResult.ExpirationTime, false); _logger.LogMessage("Token Type: " + tokenResult.TokenType, false); _rootNode = AddRootNode("Buckets"); ExpandNode(_rootNode); foreach(var bucket in LoadNodes()) { var bucketResponse = await _viewDataClient.GetBucketDetailsAsync( bucket.BucketKey); if (!bucketResponse.IsOk()) continue; var node = _rootNode.AddNode(new TreeItem(bucketResponse)); foreach (var obj in bucket.Objects) { var objectResponse = await _viewDataClient.GetObjectDetailsAsync( bucket.BucketKey, obj.ObjectKey); if (!objectResponse.IsOk()) continue; foreach (var objDetails in objectResponse.Objects) { var item = new TreeItem(objDetails); var thumbnailResponse = await item.LoadThumbnail(); node.AddNode(item); } } } var formatResponse = await _viewDataClient.GetSupportedFormats(); if (formatResponse.IsOk()) { string fileTypes = ""; foreach (var fileType in formatResponse.Extensions) fileTypes += "*." + fileType + ";"; _supportedFileFilter = "Supported Formats |" + fileTypes; } }
///////////////////////////////////////////////////////////////////////////////// // // ///////////////////////////////////////////////////////////////////////////////// async void Authenticate() { var tokenResult = await _viewDataClient.AuthenticateAsync(); if (!tokenResult.IsOk()) { _logger.LogError( "Authentication failed: " + tokenResult.Error.Reason); return; } _logger.LogMessage("Login successful :)"); _logger.LogMessage("Access Token: " + tokenResult.AccessToken, false); _logger.LogMessage("Expiration Time (sec): " + tokenResult.ExpirationTime, false); _logger.LogMessage("Token Type: " + tokenResult.TokenType, false); _rootNode = AddRootNode("Buckets"); ExpandNode(_rootNode); foreach (var bucket in LoadNodes()) { var bucketResponse = await _viewDataClient.GetBucketDetailsAsync( bucket.BucketKey); if (!bucketResponse.IsOk()) { continue; } var node = _rootNode.AddNode(new TreeItem(bucketResponse)); foreach (var obj in bucket.Objects) { var objectResponse = await _viewDataClient.GetObjectDetailsAsync( bucket.BucketKey, obj.ObjectKey); if (!objectResponse.IsOk()) { continue; } foreach (var objDetails in objectResponse.Objects) { var item = new TreeItem(objDetails); var thumbnailResponse = await item.LoadThumbnail(); node.AddNode(item); } } } var formatResponse = await _viewDataClient.GetSupportedFormats(); if (formatResponse.IsOk()) { string fileTypes = ""; foreach (var fileType in formatResponse.Extensions) { fileTypes += "*." + fileType + ";"; } _supportedFileFilter = "Supported Formats |" + fileTypes; } }