G
Guest
Hi,
I need help to handle out of memory, argument exception my .net CF 1.1
pocket pc application is throwing. Basically the following code will accept
gps latitude and longitude coordinates as arguments and display image
returned from a mappoint webservice in a picturebox control and this code is
called repeatively until there were no Gps LAt/long coordinates.
And here is my code
private void GetMapImage(double latit,double longit)
{
try
{
double latit1,longit1;
latit1=latit;
longit1=longit;
Credentials();
LatLong myLatLong=new LatLong();
myLatLong.Latitude=latit;
myLatLong.Longitude=longit;
Location[] returnedLocations;
returnedLocations = findService.GetLocationInfo(myLatLong, "MapPoint.NA",
null);
FindAddressSpecification myaddress= new FindAddressSpecification();
myaddress.DataSourceName="Mappoint.NA";
myaddress.InputAddress=returnedLocations[0].Address;
FindResults results =new FindResults();
results = findService.FindAddress(myaddress);
myViews[0] = results.Results0].FoundLocation.BestMapView.ByHeightWidth;
//Displaying Pushpins
Pushpin[] myPushpins = new Pushpin[1];
myPushpins[0] = new Pushpin();
myPushpins[0].IconDataSource="MapPoint.Icons";
myPushpins[0].IconName = "32";
myPushpins[0].Label = WrapText("You are here",10);
myPushpins[0].LatLong =myViews[0].CenterPoint;
myPushpins[0].ReturnsHotArea=true;
MapSpecification mapSpec = new MapSpecification();
Point MapDimensions=new Point();
mapSpec.DataSourceName ="MapPoint.NA";
mapSpec.Options=new MapOptions();
mapSpec.Options.ReturnType=MapReturnType.ReturnImage;
mapSpec.Options.Format=new ImageFormat();
mapSpec.Options.Format.MimeType="image/png";
mapSpec.Options.Format.Width=pbMyLocationMap.Width;
mapSpec.Options.Format.Height=pbMyLocationMap.Height;
mapSpec.Views = myViews;
mapSpec.Pushpins = myPushpins;
//Displaying the Map
MapImage[] mapImages =RenderService.GetMap(mapSpec);
pbMyLocationMap.Image= new Bitmap(new
System.IO.MemoryStreammapImages[0].MimeData.Bits));
}
catch(System.OutOfMemoryException ex)
{
throw new Exception(ex.Message,ex);
}
catch(System.ArgumentException ex)
{
throw new Exception(ex.Message,ex);
}
}----> Argument exception is showing at the following location. I didnt get
whats going on. Don' know how to print the stack trace information in .net
CF1.1 .net 2003 c#
And someone suggested not to load the bitmap in C# smart device applications.
Anyone pls guide me.
Thanks so much in advance,
I need help to handle out of memory, argument exception my .net CF 1.1
pocket pc application is throwing. Basically the following code will accept
gps latitude and longitude coordinates as arguments and display image
returned from a mappoint webservice in a picturebox control and this code is
called repeatively until there were no Gps LAt/long coordinates.
And here is my code
private void GetMapImage(double latit,double longit)
{
try
{
double latit1,longit1;
latit1=latit;
longit1=longit;
Credentials();
LatLong myLatLong=new LatLong();
myLatLong.Latitude=latit;
myLatLong.Longitude=longit;
Location[] returnedLocations;
returnedLocations = findService.GetLocationInfo(myLatLong, "MapPoint.NA",
null);
FindAddressSpecification myaddress= new FindAddressSpecification();
myaddress.DataSourceName="Mappoint.NA";
myaddress.InputAddress=returnedLocations[0].Address;
FindResults results =new FindResults();
results = findService.FindAddress(myaddress);
myViews[0] = results.Results0].FoundLocation.BestMapView.ByHeightWidth;
//Displaying Pushpins
Pushpin[] myPushpins = new Pushpin[1];
myPushpins[0] = new Pushpin();
myPushpins[0].IconDataSource="MapPoint.Icons";
myPushpins[0].IconName = "32";
myPushpins[0].Label = WrapText("You are here",10);
myPushpins[0].LatLong =myViews[0].CenterPoint;
myPushpins[0].ReturnsHotArea=true;
MapSpecification mapSpec = new MapSpecification();
Point MapDimensions=new Point();
mapSpec.DataSourceName ="MapPoint.NA";
mapSpec.Options=new MapOptions();
mapSpec.Options.ReturnType=MapReturnType.ReturnImage;
mapSpec.Options.Format=new ImageFormat();
mapSpec.Options.Format.MimeType="image/png";
mapSpec.Options.Format.Width=pbMyLocationMap.Width;
mapSpec.Options.Format.Height=pbMyLocationMap.Height;
mapSpec.Views = myViews;
mapSpec.Pushpins = myPushpins;
//Displaying the Map
MapImage[] mapImages =RenderService.GetMap(mapSpec);
pbMyLocationMap.Image= new Bitmap(new
System.IO.MemoryStreammapImages[0].MimeData.Bits));
}
catch(System.OutOfMemoryException ex)
{
throw new Exception(ex.Message,ex);
}
catch(System.ArgumentException ex)
{
throw new Exception(ex.Message,ex);
}
}----> Argument exception is showing at the following location. I didnt get
whats going on. Don' know how to print the stack trace information in .net
CF1.1 .net 2003 c#
And someone suggested not to load the bitmap in C# smart device applications.
Anyone pls guide me.
Thanks so much in advance,