c#.. Exception (simple code and method)

luisfdo
05-24-2005, 08:17 PM
ViewByHeightWidth[] myViews = new ViewByHeightWidth[1];
myViews[0] = new ViewByHeightWidth();
myViews[0].CenterPoint = new LatLong();
myViews[0].CenterPoint.Latitude = 40;
myViews[0].CenterPoint.Longitude = -120;
myViews[0].Height = 200;
myViews[0].Width = 300;

Pushpin[] myPushpins = new Pushpin[1];
myPushpins[0] = new Pushpin();
myPushpins[0].IconDataSource = "MapPoint.Icons";
myPushpins[0].IconName = "3";
myPushpins[0].LatLong = myViews[0].CenterPoint;
myPushpins[0].Label = "Center";
myPushpins[0].LabelNearbyRoads = true;

MapSpecification mapSpec = new MapSpecification();
mapSpec.DataSourceName = "MapPoint.NA";
mapSpec.Views = myViews;
mapSpec.Pushpins = myPushpins;

render = new RenderServiceSoap();
render.Credentials = new System.Net.NetworkCredential(User,Pass);
render.PreAuthenticate=true;

MapImage[] mapImages = render.GetMap(mapSpec);

Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImages[0].MimeData.Bits) );

pictureMapPoint.Image=bMap;

I'm working in a Pocket Application and there is an exception in this line
Bitmap bMap = new Bitmap(new System.IO.MemoryStream(mapImages[0].MimeData.Bits) );


This same code works fine in a WindowsApplication, but not in the Pocket application tha I need.

Does anyone know why?? can you prove this method??

Please help me.. :cry:

thanks..

Jeurink
05-26-2005, 09:45 AM
Hi,

I think this is more a .NET compact framework (i'm assuming that you are using that?) problem than an mappoint issue.

Wilfried
05-26-2005, 02:49 PM
Hi,

Possible some of the functions does just not work on pocket pc. If your application work on windows then it seems ok to me, if it does not work on pocket pc then some of the functions are just not pocket compatible. I'm sorry if this does not give any help :(

 
Web mp2kmag.com
mapforums.com