"Silverlight" Bing Maps Development Application and techniques three: Bing Maps Silverlight Control

Source: Internet
Author: User
Tags silverlight

Development and application of "Silverlight" Bing Maps Three: Offline development of Bing Maps Silverlight control

I believe most of the friends using Bing Maps have seen the following picture, when we are developing Bing maps, it is wrong to create a bug in the following illustration that the user authorization failed to verify the error.

The disadvantage of using the Bing Maps Silverlight control development is that it defaults to using the online map data that Microsoft itself provides, and that Bing Maps Silverlight control is bound to the developer account for normal use. If the development key fill in the wrong or do not fill out the development key will appear on the diagram above the hint. In fact, this validation failure message can be blocked, and we can also use the Bing Maps Silverlight control to do our off-line (not using the Microsoft Map data, not through user development key verification) developed.

Through careful analysis can know, whether we are doing a limited or offline, in essence, there is no big difference, is the load of the map data is different, to solve the loading of different map data can be achieved through a custom tilesource. In addition to solve a problem, is not through the development of key validation in the case of how to kill the error hint layer, that is, delete or mask the error hint layer.

In actual development, we can not directly block the error message layer, only through other indirect way to deal with. A closer look at the API reveals that the Bing Maps Silverlight control's map controls have a Loaderror event in which we can move some hands and feet to kill the hateful error tip layer. The processing code for LOADERROR events can be found by reflector decompile:

private void Map_LoadingError(object sender, LoadingErrorEventArgs e)
{
     if (this.loadingErrorMessage == null)
     {
         this.loadingErrorMessage = new LoadingErrorMessage();
         base.RootLayer.get_Children().Add(this.loadingErrorMessage);
     }
     if (e.get_LoadingException() is UriSchemeNotSupportedException)
     {
         this.loadingErrorMessage.SetUriSchemeError(base.Culture);
     }
     else if (e.get_LoadingException() is ConfigurationNotLoadedException)
     {
         this.loadingErrorMessage.SetConfigurationError(base.Culture);
     }
     else if (e.get_LoadingException() is CredentialsInvalidException)
     {
         this.loadingErrorMessage.SetCredentialsError(base.Culture);
     }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.