Difference between revisions of "PAV I CSharp"

From CDYNE Wiki
Jump to navigation Jump to search
imported>Nfesette
(Created page with "This the C# code example that we used in our simple helper WPF application. <code type=csharp> //Service client instance PavIntService.PavInternationalServiceClient service = nu...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 +
'''PAV-I will be discontinued in March 2013. We sincerely appreciate your support and regret any inconvenience this may cause.'''
 +
 
This the C# code example that we used in our simple helper WPF application.
 
This the C# code example that we used in our simple helper WPF application.
  
<code type=csharp>
+
<syntaxhighlight lang=c# line=line>
 
//Service client instance
 
//Service client instance
 
PavIntService.PavInternationalServiceClient service = null;
 
PavIntService.PavInternationalServiceClient service = null;
Line 12: Line 14:
 
     service = new PavIntService.PavInternationalServiceClient("pavisoap");
 
     service = new PavIntService.PavInternationalServiceClient("pavisoap");
 
}
 
}
</code>
+
</syntaxhighlight>
  
 
Button click handler:
 
Button click handler:
  
<code type=csharp>
+
<syntaxhighlight lang=csharp line=line>
 
private void button1_Click(object sender, RoutedEventArgs e)
 
private void button1_Click(object sender, RoutedEventArgs e)
 
{
 
{
Line 57: Line 59:
 
}
 
}
  
</code>
+
</syntaxhighlight>
  
 
3rd party C# .Net tutorial can be found here: [http://vmercep.blogspot.com/2012/02/cdyne-pav-i-global-postal-address.html Video and Source],
 
3rd party C# .Net tutorial can be found here: [http://vmercep.blogspot.com/2012/02/cdyne-pav-i-global-postal-address.html Video and Source],

Latest revision as of 14:20, 24 January 2019

PAV-I will be discontinued in March 2013. We sincerely appreciate your support and regret any inconvenience this may cause.

This the C# code example that we used in our simple helper WPF application.

 1 //Service client instance
 2 PavIntService.PavInternationalServiceClient service = null;
 3 
 4 public MainWindow()
 5 {
 6     InitializeComponent();
 7 
 8     //create the client using soap endpoint
 9     service = new PavIntService.PavInternationalServiceClient("pavisoap");
10 }

Button click handler:

 1 private void button1_Click(object sender, RoutedEventArgs e)
 2 {
 3     PavIntService.AddressInternationalRequest request = new PavIntService.AddressInternationalRequest();
 4 
 5     //Check each textbox and add corresponding field if the textbox is not empty
 6     List<KeyValue> availableFields = new List<KeyValue>();            
 7     AddKeyValue(availableFields, ORGANISATION, "ORGANISATION");
 8     AddKeyValue(availableFields, SUBBUILDING, "SUBBUILDING");
 9     AddKeyValue(availableFields, BUILDINGNAME, "BUILDINGNAME");
10     AddKeyValue(availableFields, BUILDINGNUMBER, "BUILDINGNUMBER");
11     AddKeyValue(availableFields, DEPSTREET, "DEPSTREET");
12     AddKeyValue(availableFields, STREET, "STREET");
13     AddKeyValue(availableFields, DEPLOCALITY, "DEPLOCALITY");
14     AddKeyValue(availableFields, LOCALITY, "LOCALITY");
15     AddKeyValue(availableFields, POSTTOWN, "POSTTOWN");
16     AddKeyValue(availableFields, COUNTY, "COUNTY");
17     AddKeyValue(availableFields, POSTCODE, "POSTCODE");
18     AddKeyValue(availableFields, ADDR, "ADDR");
19                
20     //Check what output fields are required on return
21     List<string> returnFields = new List<string>();
22     GetReturnFields(returnFields);
23 
24     //Convert to array and add to the request 
25     request.AddressFields = availableFields.ToArray();
26     request.ReturnFields = returnFields.ToArray();
27 
28     //Set License key
29     request.LicenseKey = "ADD VALID LICENSE KEY HERE";
30 
31     //Check if native output is requested
32     request.ReturnNativeOutput = (chkNATIVE.IsChecked == true);
33 
34     //Call the service
35     AddressInternationalResponse response = service.VerifyAddressInternational(request);
36 
37     //Update UI with the results
38     UpdateUI(response.AddressFields);
39 }

3rd party C# .Net tutorial can be found here: Video and Source,