Retrieve Container Data from Azure to Windows Apps

Step 1: Create storage.



Step 2:
Create Container. Set to Public Container.



Upload the Images using Azure Storage Explorer tool or app.



Step 3:
Start Visual Studio Create Windows 8 New XAML/ C# App.

Right click on “References” & select “Manage NuGet Packages…”



Enter the term for search “Windows Azure Storage”.



Step 4: A
fter installation Windows Azure Storage Package or DLL added to the App.



Step 5:
Open MainPage.xaml file.

  1. <Grid Background="{StaticResourceApplicationPageBackgroundThemeBrush}">  
  2.     <ListBox x:Name="myListBox">  
  3.         <ListBox.ItemTemplate>  
  4.             <DataTemplate>  
  5.                 <StackPanel Orientation="Horizontal">  
  6.                     <TextBlock Text="{Binding}" Height="200" Width="1000" />  
  7.                     <Image Source="{Binding}" Height="100" Width="100" />  
  8.                 </StackPanel>  
  9.             </DataTemplate>  
  10.         </ListBox.ItemTemplate>  
  11.   
  12.     </ListBox>  
  13. </Grid>  
Step 6: Open MainPage.xaml.cs file.

Add few references
  1. usingMicrosoft.WindowsAzure.Storage;  
  2. usingMicrosoft.WindowsAzure.Storage.Auth;  
  3. usingMicrosoft.WindowsAzure.Storage.Blob;  
  4. usingSystem.Diagnostics;  
  5. protectedasyncoverridevoidOnNavigatedTo(NavigationEventArgs e)  
  6. {  
  7.     var credentials = newStorageCredentials("fortestingnew""96OdFITud72q8RTfhsJeM1i1Yov8Qlrk9sXLBKOjh7FtOsxYV3klrScv7AE53R8keH9Ylj8JTbBSf177wBDjIw==");  
  8.     var account = newCloudStorageAccount(credentials, true);  
  9.     varblobClient = account.CreateCloudBlobClient();  
  10.     var container = blobClient.GetContainerReference("myowncontainer");  
  11.     awaitcontainer.CreateIfNotExistsAsync();  
  12.     BlobContinuationToken x = newBlobContinuationToken();  
  13.     BlobResultSegment result = awaitcontainer.ListBlobsSegmentedAsync(x);  
  14.     List < string > dataSet = newList < string > ();  
  15.     foreach(var item inresult.Results)  
  16.     {  
  17.         dataSet.Add(item.Uri.AbsoluteUri);  
  18.         //Debug.WriteLine(item.Uri.AbsoluteUri);  
  19.     }  
  20.     myListBox.ItemsSource = dataSet;  
  21.     //container.ListBlobsSegmentedAsync(string.Empty, true, Microsoft.WindowsAzure.Storage.Blob.BlobListingDetails.All, null, tokenSource);  
  22. }  
Now run the App.

Retrieving the url & image.

 

Ebook Download
View all
TOP Azure
Read by 1 people
Download Now!
Learn
View all