Hey all, I'm unfamiliar with C# and .NET, so I imagine (hope) this is a very basic question.I am trying to load up a kml file into a specific folder. I want to check to see if the folder already exists. If it does, I want to put the kml layer into that folder. However, I keep getting hung up on the fact that the search result is a mapitem, but I need the variable as a folder type in order to use the MoveTo method:
KmlLayer NewGPS = KmlLayer.Open(@"c:\myplacemark.kml");
//Obtain the Map from the Application used to update the layer panel
Map dispmap = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map;
ESRI.ArcGISExplorer.Mapping.MapItem exgpslogs = dispmap.FindByName("GPS Logs");
if (exgpslogs == null)
{
ESRI.ArcGISExplorer.Mapping.Folder gpslogs = new ESRI.ArcGISExplorer.Mapping.Folder("GPS Logs");
NewGPS.MoveTo(gpslogs);
dispmap.ChildItems.Add(gpslogs);
}
else
{
NewGPS.MoveTo(exgpslogs); //gives the error
dispmap.ChildItems.Add(exgpslogs);
}
the NewGPS.MoveTo(exgpslogs) line does not compile and gives the error:cannot convert from 'ESRI.ArcGISExplorer.Mapping.MapItem' to 'ESRI.ArcGISExplorer.Mapping.IMapItemParent'Any help would be appreciated.ThanksNormanEDIT: figured out how to do the explicit cast. Offending line has to be:
NewGPS.MoveTo((ESRI.ArcGISExplorer.Mapping.Folder)gpslogs);