01.
public
partial
class
MainPage : PhoneApplicationPage
02.
{
03.
04.
public
MainPage()
05.
{
06.
InitializeComponent();
07.
Loaded += MainPage_Loaded;
08.
}
09.
10.
private
async
void
MainPage_Loaded(
object
sender, System.Windows.RoutedEventArgs e)
11.
{
12.
13.
String StorageConnectionString =
"DefaultEndpointsProtocol=https;AccountName=[yourAccount];AccountKey=[yourKey]"
;
14.
15.
16.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(StorageConnectionString);
17.
18.
19.
CloudTableClient tableClient = storageAccount.CreateCloudTableClient();
20.
21.
22.
CloudTable table = tableClient.GetTableReference(
"customer"
);
23.
24.
25.
TableOperation retrieveOperation = TableOperation.Retrieve<CustomerEntity>(
"myCustomer"
,
"C001"
);
26.
27.
28.
TableResult retrievedResult = table.ExecuteBatchAsync(retrieveOperation);
29.
30.
31.
CustomerEntity updateEntity = (CustomerEntity)retrievedResult.Result;
32.
33.
if
(updateEntity !=
null
)
34.
{
35.
updateEntity.CustomerID = txtCustomerID.Text;
36.
updateEntity.Name = txtName.Text;
37.
updateEntity.Email = txtEmail.Text;
38.
updateEntity.CountryCode = txtCountryCode.Text;
39.
updateEntity.Budget = txtBudget.Text;
40.
updateEntity.Used = txtUsed.Text;
41.
42.
43.
TableOperation insertOrReplaceOperation = TableOperation.InsertOrReplace(updateEntity);
44.
45.
46.
table.ExecuteBatchAsync(insertOrReplaceOperation);
47.
48.
}
49.
50.
}
51.
}