当前位置: 首页>>代码示例>>C#>>正文


C# JsonObject.AddBoolean方法代码示例

本文整理汇总了C#中JsonObject.AddBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.AddBoolean方法的具体用法?C# JsonObject.AddBoolean怎么用?C# JsonObject.AddBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JsonObject的用法示例。


在下文中一共展示了JsonObject.AddBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateService

        /// <summary>
        /// create service type MapServer
        /// </summary>
        /// <returns>>True if successfully created</returns>
        public bool CreateService()
        {
            try
            {
                string token = this.GenerateAGSToken();
                string serviceUrl = this.urlRestAdmin + "/services/createService";

                JsonObject jsonObject = new JsonObject();
                jsonObject.AddString("serviceName", "Test");
                //服务类型
                jsonObject.AddString("type", Enum.GetName(typeof(ServiceType), ServiceType.GPServer));
                jsonObject.AddString("description", "This is an example");
                //不同的服务类型,其capabilities是不同的,地图服务的为Map,query和data
              //  jsonObject.AddString("capabilities", "Map,Query,Data");

                jsonObject.AddString("capabilities","Uploads");//gp 服务的capabilities
                jsonObject.AddString("clusterName", "default");
                jsonObject.AddLong("minInstancesPerNode", 1);
                jsonObject.AddLong("maxInstancesPerNode", 2);
                jsonObject.AddLong("maxWaitTime", 60);
                jsonObject.AddLong("maxStartupTime", 300);
                jsonObject.AddLong("maxIdleTime", 1800);
                jsonObject.AddLong("maxUsageTime", 600);
                jsonObject.AddLong("recycleInterval", 24);
                jsonObject.AddString("loadBalancing", Enum.GetName(typeof(LoadBalancing), LoadBalancing.ROUND_ROBIN));
                jsonObject.AddString("isolationLevel", Enum.GetName(typeof(IsolationLevel), IsolationLevel.HIGH));

                JsonObject jsonObjectProperties = new JsonObject();

                // see for a list complete http://resources.arcgis.com/en/help/server-admin-api/serviceTypes.html
                jsonObjectProperties.AddLong("maxBufferCount", 100); // optional 100
                jsonObjectProperties.AddString("virtualCacheDir", this.urlRestServer + "/arcgiscache"); // optional
                jsonObjectProperties.AddLong("maxImageHeight", 2048); // optional 2048
                jsonObjectProperties.AddLong("maxRecordCount", 1000); // optional 500

               //10.1中服务是通过msd的形式发布的,所以创建地图服务时候将mxd转换成msd的形式,创建msd的形式而其他服务的数据发布形式,参考上面的链接

              //  jsonObjectProperties.AddString("filePath", @"C:\AvGis\Test\mappa\UTM_ReteFognaria.msd"); //地图服务 required

                jsonObjectProperties.AddString( "toolbox",@"d:\Buffer.tbx");//gp服务使用的是路径创建gp服务的路径

                jsonObjectProperties.AddLong("maxImageWidth", 2048); // optional 2048
                jsonObjectProperties.AddBoolean("cacheOnDemand", false); // optional false
                jsonObjectProperties.AddString("virtualOutputDir", this.urlRestServer + "/arcgisoutput");
                jsonObjectProperties.AddString("outputDir", @"C:\arcgisserver\directories\arcgisoutput");
                jsonObjectProperties.AddString("jobsDirectory", @"C:\arcgisserver\directories\arcgisjobs");                                                                             // required
                jsonObjectProperties.AddString("supportedImageReturnTypes", "MIME+URL"); // optional MIME+URL
                jsonObjectProperties.AddBoolean("isCached", false); // optional false
                jsonObjectProperties.AddBoolean("ignoreCache", false); // optional false
                jsonObjectProperties.AddBoolean("clientCachingAllowed", false); // optional true
                jsonObjectProperties.AddString("cacheDir", @"C:\arcgisserver\directories\arcgiscache"); // optional

                jsonObject.AddJsonObject("properties", jsonObjectProperties);

                string result = this.GetResult(serviceUrl, "service=" +HttpUtility.UrlEncode(jsonObject.ToJson()) + "&f=json&token=" + token);
                return this.HasSuccess(result);

            }
            catch
            {
                return false;
            }
        }
开发者ID:jackyped,项目名称:blog,代码行数:67,代码来源:AGSAdmin.cs

示例2: RootResHandler

        private byte[] RootResHandler(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties)
        {
            responseProperties = null;

            JsonObject result = new JsonObject();
            result.AddString("Description", "Get raster item statistics in a mosaic dataset");
            result.AddBoolean("SupportRasterItemAccess", _supportRasterItemAccess);

            return Encoding.UTF8.GetBytes(result.ToJson());
        }
开发者ID:xyhxyw,项目名称:DeveloperSumit2014,代码行数:10,代码来源:Image_Services_SOE.cs

示例3: PropertiesResHandler

        private byte[] PropertiesResHandler(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties)
        {
            responseProperties = "{\"Content-Type\" : \"application/json\"}";

            JsonObject result = new JsonObject();
            result.AddString("layers", this.layerType);
            result.AddString("returnFormat", this.returnFormat);
            result.AddLong("maxNumFeatures", this.maxNumFeatures);
            result.AddBoolean("isEditable", this.isEditable);

            return Encoding.UTF8.GetBytes(result.ToJson());         
            
        }
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:13,代码来源:NetSimpleRESTSOEWithProperties.cs

示例4: backgroundWorker1_DoWork


//.........这里部分代码省略.........
                            foreach (JsonObject js_field in ls_fields_cache)
                            {
                                object value = fea_poi.get_Value(i);
                                string fieldtype;
                                js_field.TryGetString("type", out fieldtype);
                                string fieldname;
                                js_field.TryGetString("name", out fieldname);
                                #region
                                if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeString))
                                {
                                    js_attributes.AddString(fieldname, value.ToString());
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeOID))
                                {
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeInteger))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeSmallInteger))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddLong(fieldname, long.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeDouble))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddDouble(fieldname, double.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeDate))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = DateTime.MinValue;
                                    }
                                    js_attributes.AddDate(fieldname, DateTime.Parse(value.ToString()));
                                }
                                else if (fieldtype == Enum.GetName(typeof(esriFieldType), esriFieldType.esriFieldTypeSingle))
                                {
                                    if (value.ToString() == "")
                                    {
                                        value = 0;
                                    }
                                    js_attributes.AddBoolean(fieldname, bool.Parse(value.ToString()));
                                }
                                #endregion
                                i++;
                            }
                            js_fea.AddJsonObject("attributes", js_attributes);
                            js_fea.AddJsonObject("geometry", Conversion.ToJsonObject(fea_poi.Shape));
                        }
                        else
                        {
                            IAnnotationFeature anno_fea = fea_poi as IAnnotationFeature;
                            ITextElement ele = anno_fea.Annotation as ITextElement;
                            //string text = ele.Text.Replace(System.Environment.NewLine, " ");
                            string text = ele.Text;
                            ITextSymbol sym = ele.Symbol;
                            IFontDisp font = sym.Font;
                            double symsize = sym.Size;
                            string fontname = font.Name;
                            decimal fontsize = font.Size;
                            string.Format(@"a"":""");
                            JsonObject js_symbol = new JsonObject(
                            string.Format(@"{{""type"" : ""esriTS"",""color"": [255,255,255],""haloSize"" : 0,""haloColor"" : [255,255,255,0],""verticalAlignment"" : ""bottom"",""horizontalAlignment"" : ""center"",""size"": {0},""angle"": 0,""xoffset"": 0,""yoffset"": 0,""font"" : {{""family"" : ""{2}"",""size"" : {3},""style"" : ""normal"",""weight"" : ""normal"",""decoration"" : ""none""}},""text"":""{1}""}}",symsize,text,fontname,fontsize)); 
                            js_fea.AddJsonObject("symbol", js_symbol);
                            IArea pshp = fea_poi.Shape as IArea; 
                            js_fea.AddJsonObject("geometry", Conversion.ToJsonObject(pshp.Centroid));
                        }
                        ls_features.Add(js_fea);
                        fea_poi = cur_poi.NextFeature();
                    }
                    response.AddArray("features", ls_features.ToArray());
                    client.StringSet(ns+grid_id.ToString(), response.ToJson());
                    ReleaseCOMObject(cur_poi);
                    grid_id++;
                    progressBar1.BeginInvoke((Action)(() =>
                    {
                        progressBar1.Increment(1);
                    }));
                }
            }
            MessageBox.Show("Build Cache Successfully!");           
            this.button1.BeginInvoke((Action)(()=>
            {
                ListCaches();
                this.button1.Enabled = true;
            }));
        }
开发者ID:305120262,项目名称:CachedLayerSystem,代码行数:101,代码来源:Form1.cs


注:本文中的JsonObject.AddBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。