01.
using
System;
02.
using
System.Collections.Generic;
03.
using
System.IO;
04.
using
System.Linq;
05.
using
Windows.Devices.Geolocation;
06.
using
Windows.Foundation;
07.
using
Windows.Foundation.Collections;
08.
using
Windows.UI.Core;
09.
using
Windows.UI.Xaml;
10.
using
Windows.UI.Xaml.Controls;
11.
using
Windows.UI.Xaml.Controls.Primitives;
12.
using
Windows.UI.Xaml.Data;
13.
using
Windows.UI.Xaml.Input;
14.
using
Windows.UI.Xaml.Media;
15.
using
Windows.UI.Xaml.Navigation;
16.
17.
using
WindowsStoreApps.myWebServices;
18.
19.
using
System.Xml.Linq;
20.
using
System.Runtime.Serialization;
21.
using
System.Runtime.Serialization.Json;
22.
using
System.Collections.ObjectModel;
23.
using
System.Text;
24.
25.
26.
27.
namespace
WindowsStoreApps
28.
{
29.
/// <summary>
30.
/// An empty page that can be used on its own or navigated to within a Frame.
31.
/// </summary>
32.
///
33.
34.
public
sealed
partial
class
MainPage : Page
35.
{
36.
public
MainPage()
37.
{
38.
this
.InitializeComponent();
39.
}
40.
41.
public
class
myCustomer
42.
{
43.
public
string
CustomerID {
get
;
set
; }
44.
public
string
Name {
get
;
set
; }
45.
public
string
Email {
get
;
set
; }
46.
public
string
CountryCode {
get
;
set
; }
47.
public
string
Budget {
get
;
set
; }
48.
public
string
Used {
get
;
set
; }
49.
}
50.
51.
private
async
void
btnSubmit_Click(
object
sender, RoutedEventArgs e)
52.
{
53.
54.
var client =
new
myWebServices.myWSVSoapClient();
55.
var result = await client.getCustomerDataAsync();
56.
57.
string
jsonData = result.Body.getCustomerDataResult;
58.
59.
MemoryStream ms =
new
MemoryStream(Encoding.UTF8.GetBytes(jsonData));
60.
ObservableCollection<myCustomer> list =
new
ObservableCollection<myCustomer>();
61.
DataContractJsonSerializer serializer =
new
DataContractJsonSerializer(
typeof
(ObservableCollection<myCustomer>));
62.
list = (ObservableCollection<myCustomer>)serializer.ReadObject(ms);
63.
64.
this
.myListView.ItemsSource = list;
65.
66.
}
67.
68.
}
69.
70.
}