This is a migrated thread and some comments may be shown as answers.

how to detect incorrect bing application key

2 Answers 105 Views
Map
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
ewart
Top achievements
Rank 1
ewart asked on 21 Jun 2010, 05:25 AM
If my bing key the user uses in my map application is incorrect then they just get a gray screen and the map runs without any exceptions.  The InitializeCompleted event fires normally - is there some property I can check to see if map key is correct?    I want to be able to popup a message to advise the user they need to supply a valid map key.

was thinking about some sort of hack, like seeing if tiles are downloaded or something but not sure how I can achieve this.

regards
   ewart.

2 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 21 Jun 2010, 09:58 AM
Hi Ewart,

We have WCF-proxy code for the Bing services which is generated automatically by VS. This code executes requests in a separate thread. When WCF service (Bing service in our case) returns ANY error this code throws an exception instead of passing error to our response handler. Since it is executed in the separate thread we can't handle this exception using try-catch.
It is good known issue with calling WCF services from Silverlight. We are working on this problem, but unfortunately we have no solution yet.
The problem you have is related to the PITS Issue we already have.
You can track its implementation by the following PITS Issue:
http://www.telerik.com/support/pits.aspx#/public/silverlight/888

As workaround you can check that the Bing Map provider has not been initialized properly within the InitializeCompleted event handler. When the provider source does not returns the Uri for minimal zoom and left-top corner of the map then the provider is not initialized properly.
Please, see the following sample code:

private void radMap_InitializeCompleted(object sender, EventArgs e)
{
    MapProviderBase source = this.radMap.Provider.GetSource(this.radMap.Provider.Mode,
        this.radMap.Provider.IsLabelVisible);
    Uri uri = source.GetTile(9, 0, 0);
    if (uri == null)
    {
        // the provider has not been initialized properly
        // Bing Maps imigary service is unavailable or application id is not valid
    }
}

Sincerely yours,
Andrey Murzov
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
ewart
Top achievements
Rank 1
answered on 28 Jun 2010, 09:23 PM
this works perfectly for me, thanks guys.
Tags
Map
Asked by
ewart
Top achievements
Rank 1
Answers by
Andrey
Telerik team
ewart
Top achievements
Rank 1
Share this question
or