public void Connect() { try { IAGSServerConnectionFactory2 factory = new AGSServerConnectionFactoryClass(); if (this.ipropertySet_0 == null) { this.ipropertySet_0 = factory.ReadConnectionPropertiesFromFile(this.string_0); } this.iagsserverConnection2_0 = factory.Open(this.ipropertySet_0, 0) as IAGSServerConnection2; this.Init(null); this.method_1(); } catch (Exception exception) { MessageBox.Show(exception.Message); Logger.Current.Error("", exception, ""); } }
private void loadLayers() { chbLayers.Items.Clear(); Dictionary <string, bool> lyrDic = msUtil.getLayerDic(cmbCon.Text, cmbSrv.Text); if (lyrDic.Count < 1) { this.UseWaitCursor = true; IAGSServerConnection2 sConn = msUtil.getServiceConnection(cmbCon.Text); Dictionary <string, int> lyrIdDic = new Dictionary <string, int>(); string sType = msUtil.getServiceType(cmbCon.Text, cmbSrv.Text); IAGSServerObjectName3 sObj = msUtil.getServiceObject(sConn, cmbSrv.Text, sType); if (sType.ToLower() == "mapserver") { IMapServer2 ms2 = msUtil.getMapService(sObj); lyrIdDic = msUtil.getLayers(ms2); } else if (sType.ToLower() == "imageserver") { IImageServer ims = msUtil.getIMageService(sObj); lyrIdDic = msUtil.getImages(ims); } msUtil.updateLayerTable(lyrIdDic, cmbCon.Text, cmbSrv.Text); lyrDic = msUtil.getLayerDic(cmbCon.Text, cmbSrv.Text); this.UseWaitCursor = false; } if (lyrDic.Count < 1) { MessageBox.Show("Can't find any layers that will allow users to download information. Setting server name to blank."); cmbSrv.Text = ""; } else { foreach (KeyValuePair <string, bool> kvp in lyrDic) { chbLayers.Items.Add(kvp.Key, kvp.Value); } } }
/// <summary> /// returns a service object given a server, service, and type /// </summary> /// <param name="serviceConnection">url</param> /// <param name="service">service name</param> /// <param name="serviceType">service type</param> /// <returns></returns> public IAGSServerObjectName3 getServiceObject(IAGSServerConnection2 serviceConnection, string service, string serviceType) { IAGSServerObjectName3 sobjN3 = null; IAGSEnumServerObjectName eSobjN = serviceConnection.ServerObjectNames; eSobjN.Reset(); IAGSServerObjectName sobjN = eSobjN.Next(); while (sobjN != null) { string nm = sobjN.Name.ToLower(); string tp = sobjN.Type.ToLower(); if (nm == service.ToLower()&&tp==serviceType.ToLower()) { sobjN3 = (IAGSServerObjectName3)sobjN; break; } sobjN = eSobjN.Next(); } return sobjN3; }
public void Disconnect() { this.igxObjectArray_0.Empty(); this.Init(null); this.iagsserverConnection2_0 = null; }