In this beginners post, I will describe three different ways to pass parameters to a Silverlight application.Method 1 - Add parameters to the URL.
Method 2 - Use InitParams (inside the Silverlight control host).
Method 3 - Read a file containing the parameters.I've created a solution containing all three. If a parameter exists on two or more methods the priority is File/URL/InitParams. The parameters are x1,y1,x2,y2 - these are the coordinates of the desired map extent. First we check if exist in the URL. If not, we move to the InitParams, In the end we load the city txt file. examples:
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html
Here there are none in the file and URL, so the InitParams takes (Sau Paulo). http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?x1=-13623000&y1=6039000&x2=-13612000&y2=6046000
Here there are in the InitParams and URL. URL wins (Seattle).http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=london
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=chicago
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=wellington
Here the URL city takes any parameter in the URL(x1,x2,y1,y2) or InitParams.sldemoTestPage.html:
Read more: Oren Gal GIS Blog
QR:
Method 2 - Use InitParams (inside the Silverlight control host).
Method 3 - Read a file containing the parameters.I've created a solution containing all three. If a parameter exists on two or more methods the priority is File/URL/InitParams. The parameters are x1,y1,x2,y2 - these are the coordinates of the desired map extent. First we check if exist in the URL. If not, we move to the InitParams, In the end we load the city txt file. examples:
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html
Here there are none in the file and URL, so the InitParams takes (Sau Paulo). http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?x1=-13623000&y1=6039000&x2=-13612000&y2=6046000
Here there are in the InitParams and URL. URL wins (Seattle).http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=london
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=chicago
http://www.galsystems.com/files/sample16.passing.parameters/sldemoTestPage.html?city=wellington
Here the URL city takes any parameter in the URL(x1,x2,y1,y2) or InitParams.sldemoTestPage.html:
Read more: Oren Gal GIS Blog
QR:
0 comments:
Post a Comment