Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am having a helluva time trying to get some basic information (server URL) about an ArcGIS Map Service using the basic IGxDialog.

So far, I am able to pop open the IGxDialog, and allow the user to pick an ArcGIS Map Service by setting the appropriate filter(GxFilterMapServers). Thats about as far as I can make it. What should I cast pGxObj to so I can more info about the map service?

IGxDialog pGxDialog = new GxDialog();
pGxDialog.AllowMultiSelect = false;
pGxDialog.Title = "Browse For AGIS Map Service";

IGxObjectFilter pGxFCFilter = new GxFilterMapServers();
pGxDialog.ObjectFilter = pGxFCFilter;

IEnumGxObject pGxObjects = null;
if (pGxDialog.DoModalOpen(0, out pGxObjects))
{
pGxObjects.Reset();
IGxObject pGxObj = pGxObjects.Next();
while (pGxObj != null)
{
// what do I do here to get more info about the map server???
}

}
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

Try IGxAGSObject.

if (pGxObj is IGxAGSObject)
{
    var agsObj = pGxObj as IGxAGSObject;
    object names;
    object values;
    agsObj.AGSServerObjectName.AGSServerConnectionName.ConnectionProperties.GetAllProperties(out names, out values);
    var n = names as string[];
    var o = values as object[];
    System.Text.StringBuilder sb = new StringBuilder();
    for(int i=0;i<n.Length;i++)
        sb.AppendLine(String.Format("{0}: {1}",n[i],o[i].ToString()));
    MessageBox.Show(sb.ToString());
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.