.NET Framework Developer Center >
.NET Development Forums
>
.NET Base Class Library
>
Library of the BingApp
Library of the BingApp
- Hi! I am a beginner in this field. In an exercise, I used the source code from http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/help/index.html, Topic: Using the Bing Maps token service. I got an error in Page.xaml.cs for BingApp.App: Error :
The type or namespace name 'BingApp' could not be found (are you missing a using directive or an assembly reference?)
I don't know how to declare the BingApp? What is its library?
Can anyone help? Thanks.
private void MyMap_Loaded(object sender, RoutedEventArgs e)
{
// Associate Bing Maps token with the Virtual Earth tile layer defined in Page.xaml
TileLayer layer = MyMap.Layers["BingLayer"] as TileLayer;
layer.Token = (Application.Current as BingApp.App).BingToken;
}
Answers
- Step 7 on this page shows how to do this.
Note there's a class declaration that derives from Application, that in step 7 is called "App"?
Do a search in Visual Studio for "Application" to find the class in your project that derives from Application. Replace "Bing.App" with that class's name. That should solve it.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byeryangMSFT, ModeratorTuesday, November 10, 2009 9:25 AM
- It's the namespace of TileLayer. Go to where you're seeing it in your code behind and hover your mouse over "TileLayer". That'll give you your namespace.
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/apiref/ESRI.ArcGIS.Client.Bing~ESRI.ArcGIS.Client.Bing.TileLayer.html
Looks like ESRI.ArcGIS.Client.Bing.
We're getting off topic now. I think it's time to close this thread and ask any other questions on another thread.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byeryangMSFT, ModeratorTuesday, November 10, 2009 9:26 AM
All Replies
- Step 7 on this page shows how to do this.
Note there's a class declaration that derives from Application, that in step 7 is called "App"?
Do a search in Visual Studio for "Application" to find the class in your project that derives from Application. Replace "Bing.App" with that class's name. That should solve it.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byeryangMSFT, ModeratorTuesday, November 10, 2009 9:25 AM
- Wonderful! Thanks for you to solve my problem. I compiled but got
Server Error in '/' Application.
Line 64: protected void Page_Load(object sender, EventArgs e)
Error 2 The type or namespace name 'TokenService' could not be found (are you missing a using directive or an assembly reference?)
Line 65: {
Line 66: TokenService.CommonService commonService =
Line 67: new TokenService.CommonService();
Where should I add the TokenService? Should I add a webservice in the project (the same as Page.xaml)? If yes, what's the URL? Thanks.
What did you specify as the namespace in step 2d?
I'd encourage you to try again, but read each and every line very carefully. 2d says to give the service a name such as "VirtualEarthService.TokenService". What name did you put in there when you added the web reference? In the example they've given with TokenService.CommonService, TokenService is the name you entered when adding the web reference in step 2d.
The URLs are on the page linked to above. Both of them.
Start at step 1, and follow through one step at a time. You can't skip any steps here.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Another Q for
<esri:Map x:Name="MyMap" Loaded="MyMap_Loaded">
<esri:Map.Layers>
<ve:TileLayer ID="BingLayer" LayerStyle="AerialWithLabels"/>
What's the namespace of ve? Thanks. - It's the namespace of TileLayer. Go to where you're seeing it in your code behind and hover your mouse over "TileLayer". That'll give you your namespace.
http://resources.esri.com/help/9.3/arcgisserver/apis/silverlight/apiref/ESRI.ArcGIS.Client.Bing~ESRI.ArcGIS.Client.Bing.TileLayer.html
Looks like ESRI.ArcGIS.Client.Bing.
We're getting off topic now. I think it's time to close this thread and ask any other questions on another thread.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser- Marked As Answer byeryangMSFT, ModeratorTuesday, November 10, 2009 9:26 AM
- Soled 2 problems and have credited your work. Thanks. But when compiling, still got error for
TokenService.CommonService commonService =
new TokenService.CommonService();
Error 2 The type or namespace name 'TokenService' could not be found (are you missing a using directive or an assembly reference?) c:\Exercise\SilverLight\GIS\SilverlightApplication_BING\SilverlightApplication_BING.Web\SilverlightApplication_BINGTestPage.aspx 66 9 SilverlightApplication_BING.Web
Should I import/using TokenService in the <script> block? Thanks.
- What did you specify as the namespace in step 2d?
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser - In Web References, added https://staging.common.virtualearth.net/find-30/common.asmx?wsdl , named
VirtualEarthService.TokenService - Then Try:
VirtualEarthService.TokenService.CommonService
You may want to consider studying C# a bit more in-depth before attempting something like this. What you're trying to do is pretty complicated, and you seem to be having some confusion regarding how namespaces and classes are resolved by the compiler. There are several good books on the subject that can give you a good head start.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser - Tried and 6 errors were gone. But got a new one:
Error 1 Source file 'C:\Exercise\SilverLight\GIS\SilverlightApplication_BING\SilverlightApplication_BING.Web\Web References\VirtualEarthService.TokenService.CommonService\Reference.cs' could not be opened ('Unspecified error ') SilverlightApplication_BING.Web
How can I solve this problem (\Reference.cs)? Thanks. - Start a new thread, close this one out, and ask your new question. This has absolutely nothing to do with the first.
Coding Light - Illuminated Ideas and Algorithms in Software
Coding Light Wiki • LinkedIn • ForumsBrowser


