Ejemplo n.º 1
0
 private CatalogNetInstance[] GetInstances()
 {
     try
     {
         string url = _tag.ToString();
         if (!url.EndsWith("/"))
         {
             url += "/";
         }
         Dictionary <string, string> args = new Dictionary <string, string>();
         args.Add(HttpCommands.cstArgNameCommand, HttpCommands.cstArgCmdGetInstanceList);
         url = url + HttpCommands.GetCatalogUrl(HttpCommands.cstCatalogPage, args);
         object             obj = GetObjectFromHttpStream.GetObject(url);
         InstanceIdentify[] ids = (InstanceIdentify[])obj;
         if (ids != null && ids.Length > 0)
         {
             CatalogNetInstance[] instances = new CatalogNetInstance[ids.Length];
             int i = 0;
             foreach (InstanceIdentify id in ids)
             {
                 instances[i] = new CatalogNetInstance(id.Name, id, id.Description);
                 i++;
             }
             return(instances);
         }
         return(null);
     }
     catch (Exception ex)
     {
         MsgBox.ShowError(ex.Message);
         return(null);
     }
 }
Ejemplo n.º 2
0
        private void LoadDatasetAndFetclass()
        {
            InstanceIdentify id = _tag as InstanceIdentify;

            try
            {
                string url = _parent.Tag.ToString();
                Dictionary <string, string> args = new Dictionary <string, string>();
                args.Add(HttpCommands.cstArgNameCommand, HttpCommands.cstArgCmdGetCatalogList);
                args.Add(HttpCommands.cstArgInstanceId, id.Id.ToString());
                url = url + HttpCommands.GetCatalogUrl(HttpCommands.cstCatalogPage, args);
                object[] objs = GetObjectFromHttpStream.GetObject(url) as object[];
                if (objs != null && objs.Length > 0)
                {
                    FetDatasetIdentify[] dsIds   = objs[0] as FetDatasetIdentify[];
                    FetClassIdentify[]   fetcIds = objs[1] as FetClassIdentify[];
                    //
                    if (dsIds != null && dsIds.Length > 0)
                    {
                        foreach (FetDatasetIdentify did in dsIds)
                        {
                            ICatalogItem cit = new CatalogNetFeatureDataset(did.Name, did.Id, did.Description);
                            AddChild(cit);
                            //
                            if (did.FetClassIds != null && did.FetClassIds.Length > 0)
                            {
                                foreach (FetClassIdentify fetcId in did.FetClassIds)
                                {
                                    ICatalogItem fcit = new CatalogNetFeatureClass(fetcId.Name, fetcId, fetcId.Description);
                                    cit.AddChild(fcit);
                                }
                            }
                        }
                    }
                    //
                    if (fetcIds != null && fetcIds.Length > 0)
                    {
                        foreach (FetClassIdentify fetcId in fetcIds)
                        {
                            ICatalogItem fcit = new CatalogNetFeatureClass(fetcId.Name, fetcId, fetcId.Description);
                            AddChild(fcit);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MsgBox.ShowError(ex.Message);
            }
        }