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


C# JSONObject.AddValue方法代码示例

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


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

示例1: ParseMailTo

 public static JSONObject ParseMailTo(string mailTo)
 {
     var result = new JSONObject();
     var parts = mailTo.Replace("mailto:", "").Split('#');
     result.AddValue("address", parts[0]);
     result.AddValue("subject", parts.Length > 1 ? parts[1] : "");
     return result;
 }
开发者ID:jeppe-andreasen,项目名称:LinqIt-Libraries,代码行数:8,代码来源:LinkEditor.ascx.cs

示例2: ParseUrl

 public static JSONObject ParseUrl(string href)
 {
     var result = new JSONObject();
     var parts = href.Split('#');
     result.AddValue("anchor", parts.Length > 1 ? parts[1] : "");
     result.AddValue("query", parts[0].Contains("?") ? parts[0].Substring(parts[0].IndexOf("?")+1) : "");
     return result;
 }
开发者ID:jeppe-andreasen,项目名称:LinqIt-Libraries,代码行数:8,代码来源:LinkEditor.ascx.cs

示例3: CreateNewFolder

 public static JSONObject CreateNewFolder(string providerName, string referenceId, string parentId, string name)
 {
     var provider = ProviderHelper.GetTreeNodeProvider(providerName, referenceId);
     var documentType = DocumentType.GetByAlias("GridModuleFolder");
     var treeNode = provider.CreateNode(name, parentId, documentType.Id.ToString());
     var result = new JSONObject();
     result.AddValue("parentId", parentId);
     result.AddValue("addedId", treeNode.Id);
     return result;
 }
开发者ID:cdrewery,项目名称:Umbraco-Public,代码行数:10,代码来源:ShareModuleDialog.aspx.cs

示例4: SubscribeToList

        public bool SubscribeToList(string listId, string email, System.Collections.Specialized.NameValueCollection userDetails)
        {
            var parameters = new JSONObject();
            parameters.AddValue("apikey", _configuration.ApiKey);
            parameters.AddValue("id", listId);
            parameters.AddValue("email_address", email);

            var result = CallMethod("listSubscribe", parameters);
            return true;
        }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:10,代码来源:MailChimpServiceV1_3.cs

示例5: GetValues

        public static JSONObject GetValues(string referenceId, string itemId)
        {
            var data = GetAccordionData(referenceId);
            var item = data.GetItem(itemId);

            JSONObject result = new JSONObject();
            result.AddValue("headline", item.Headline);
            result.AddValue("content", item.Content);

            result.AddValue("isRoot", item.Id == data.Id);

            if (item.Id == data.Id)
            {
                result.AddValue("canMoveUp", false);
                result.AddValue("canMoveDown", false);
            }
            else
            {
                var parent = item.Parent;
                var index = item.Parent.Items.IndexOf(item);
                result.AddValue("canMoveUp", index > 0);
                result.AddValue("canMoveDown", index < parent.Items.Count-1);
            }

            if (!string.IsNullOrEmpty(item.ModuleId))
            {
                var module = CmsService.Instance.GetItem<Entity>(new Id(item.ModuleId));
                if (module != null)
                {
                    result.AddValue("moduleId", item.ModuleId);
                    result.AddValue("moduleName", module.EntityName);
                }
            }
            return result;
        }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:35,代码来源:AccordionEditorHandler.aspx.cs

示例6: AddAccordionSibling

 public static JSONObject AddAccordionSibling(string itemId, string referenceId)
 {
     var data = GetAccordionData(referenceId);
     var item = data.GetItem(itemId);
     var parent = item.Parent;
     var newItem = data.AddItem(parent.Id, "New Accordion Item", "", "");
     var result = new JSONObject();
     result.AddValue("addedId", newItem.Id);
     result.AddValue("parentId", parent.Id);
     return result;
 }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:11,代码来源:AccordionEditorHandler.aspx.cs

示例7: AddImageGalleryChild

        public static JSONObject AddImageGalleryChild(string itemId, string referenceId)
        {
            var item = new ImageGalleryItem("New Image", Id.Null, "", "");
            var data = GetImageGalleryData(referenceId);
            var before = data.Items.Where(i => i.Id == itemId).FirstOrDefault();
            if (before == null)
                data.Items.Add(item);
            else
                data.Items.Insert(data.Items.IndexOf(before)+1, item);

            var result = new JSONObject();
            result.AddValue("rootId", HttpContext.Current.Request.QueryString["itemId"]);
            result.AddValue("addedId", item.Id.ToString());
            return result;
        }
开发者ID:cdrewery,项目名称:Umbraco-Public,代码行数:15,代码来源:Handler.aspx.cs

示例8: GetLists

        public IEnumerable<MailingList> GetLists()
        {
            var parameters = new JSONObject();
            parameters.AddValue("apikey", _configuration.ApiKey);
            var result = CallMethod("lists", parameters);
            var count = (int) result["total"];
            if (count == 0)
                return new MailingList[0];
            var data = (JSONArray) result["data"];

            return data.Values.Cast<JSONObject>().Select(o => new MailingList((string)o["id"], HttpUtility.HtmlDecode((string)o["name"]))).ToArray();
        }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:12,代码来源:MailChimpServiceV1_3.cs

示例9: OnPreRender

        protected override void OnPreRender(EventArgs e)
        {
            var options = new JSONObject();
            options.AddValue("mode", "exact");
            if (Width.HasValue)
                options.AddValue("width", Width.Value.Value.ToString());
            options.AddValue("elements", _textbox.ClientID);
            options.AddValue("theme", "advanced");
            options.AddValue("plugins", GetPlugins());
            options.AddValue("theme_advanced_buttons1", GetButtons1());
            options.AddValue("theme_advanced_buttons2", GetButtons2());
            options.AddValue("theme_advanced_buttons3", GetButtons3());
            //options.AddValue("theme_advanced_buttons4", GetButtons4());
            options.AddValue("theme_advanced_toolbar_location", "top");
            options.AddValue("theme_advanced_toolbar_align", "left");
            options.AddValue("theme_advanced_statusbar_location", "bottom");
            //options.AddValue("theme_advanced_resizing", true);
            options.AddValue("template_external_list_url", "lists/template_list.js");
            options.AddValue("external_link_list_url", "lists/link_list.js");
            options.AddValue("external_image_list_url", "lists/image_list.js");
            options.AddValue("media_external_list_url", "lists/media_list.js");
            //options.AddValue("style_formats", JSONArray.Parse("[{title : 'Bold text', inline : 'b'},{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},{title : 'Example 1', inline : 'span', classes : 'example1'},{title : 'Example 2', inline : 'span', classes : 'example2'},{title : 'Table styles'},{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}]"));
            options.AddValue("template_replace_values", JSONObject.Parse("{ username : \"Some User\", staffid : \"991234\" }"));

            if (!string.IsNullOrEmpty(HiddenId))
            {
                var setup = new JSONDelegate("ed");
                setup.Lines.Add("ed.onInit.add(function(ed, evt) {");
                setup.Lines.Add("initializeEditorValue(ed, doc, '" + HiddenId + "');");
                setup.Lines.Add("var dom = ed.dom;");
                setup.Lines.Add("var doc = ed.getDoc();");
                setup.Lines.Add("tinymce.dom.Event.add(doc, 'blur', function(e) {");
                setup.Lines.Add("updateEditorValue(ed, doc,'" + HiddenId + "');");
                setup.Lines.Add("});");
                setup.Lines.Add("});");
                options.AddValue("setup", setup);
            }
            var script = new StringBuilder();
            script.AppendLine("tinyMCE.init(" + options.ToString() + ");");

            if (RegisterFormBind)
                script.AppendLine("$(theForm).bind(\"onSave\", function() { $(\"#" + _textbox.ClientID + "\").val(tinyMCE.get('" + _textbox.ClientID + "').save()); });");

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "tinyMCEditor" + _textbox.ClientID, script.ToString(), true);

            base.OnPreRender(e);
        }
开发者ID:Psolow,项目名称:Umbraco-Public,代码行数:47,代码来源:TinyMCEditor.cs

示例10: ToString

 public override string ToString()
 {
     var result = new JSONObject();
     if (!string.IsNullOrEmpty(Query))
         result.AddValue("q", Query);
     if (!string.IsNullOrEmpty(TemplateName))
         result.AddValue("t", TemplateName);
     if (From.HasValue)
         result.AddValue("df", From.Value);
     if (To.HasValue)
         result.AddValue("dt", To.Value);
     if (CategorizationIds != null && CategorizationIds.Any())
     {
         var cids = new JSONArray();
         cids.AddRange(CategorizationIds.Select(id => id.IntValue));
         result.AddValue("cids", cids);
     }
     return result.ToString();
 }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:19,代码来源:SearchFilter.cs

示例11: GetListsTmp

 public string GetListsTmp()
 {
     var parameters = new JSONObject();
     parameters.AddValue("apikey", _configuration.ApiKey);
     return CallMethod("lists", parameters).ToString();
 }
开发者ID:jeppe-andreasen,项目名称:Umbraco-Public,代码行数:6,代码来源:MailChimpServiceV1_3.cs

示例12: ToObject

 public JSONObject ToObject()
 {
     JSONObject result = new JSONObject();
     result.AddValue("text", Headline);
     result.AddValue("content", Content);
     result.AddValue("moduleId", ModuleId);
     JSONArray items = new JSONArray();
     foreach (var child in Items)
         items.AddValue(child.ToObject());
     result.AddValue("items", items);
     return result;
 }
开发者ID:jeppe-andreasen,项目名称:LinqIt-Libraries,代码行数:12,代码来源:AccordionData.cs

示例13: HandleChange

        public static JSONObject HandleChange(JSONArray request)
        {
            var provider = new LinqIt.UmbracoCustomFieldTypes.UmbracoTreeModuleProvider(HttpContext.Current.Request.QueryString["itemId"]);
            var placeholderData = provider.GetPlaceholderData();

            var layout = provider.GetLayout().Rows.SelectMany(r => r.Cells).ToArray();

            var result = layout.ToDictionary(cell => cell.Key, cell => new GridPlaceholderData(cell.Key, cell.ColumnSpan));

            var response = new JSONObject();
            var messages = new JSONArray();
            response.AddValue("messages", messages);

            foreach (JSONObject replacement in request.Values)
            {
                var from = (string) replacement["from"];
                var id = (string) replacement["id"];
                var to = (string) replacement["to"];

                var message = new JSONObject();
                message.AddValue("ph", from);
                message.AddValue("id", id);

                if (string.IsNullOrEmpty(to))
                {
                    message.AddValue("type", "alert");
                    message.AddValue("text", _removedMessage);
                }
                else
                {
                    var oldItem = placeholderData[from].Items.Where(i => i.Id == id).FirstOrDefault();
                    var newItem = provider.GetItem(id);
                    newItem.ColumnSpan = oldItem.ColumnSpan;

                    var cell = result[to];
                    if (cell.Items.Where(i => i.Id == newItem.Id).Any())
                    {
                        message.AddValue("type", "alert");
                        message.AddValue("text", _duplicateMessage);
                    }
                    else
                    {
                        if (cell.Span < newItem.ColumnSpan)
                        {
                            newItem.ColumnSpan = provider.GetItemColumnOptions(id).Where(o => o <= cell.Span).Max();
                            message.AddValue("type", "info");
                            message.AddValue("text", string.Format(_resizedMessage, newItem.ColumnSpan));
                        }
                        else
                        {
                            message.AddValue("type", "ok");
                        }
                        cell.AddItem(newItem);
                    }
                }
                messages.AddValue(message);
            }

            response.AddValue("hiddenId", HttpContext.Current.Request.QueryString["hiddenId"]);
            var values = new JSONArray();
            values.AddRange(result.Values.Select(v => v.ToJSON()).ToArray());
            response.AddValue("value", values.ToString());
            return response;
        }
开发者ID:Psolow,项目名称:Umbraco-Public,代码行数:64,代码来源:FixGridLayoutHandler.aspx.cs

示例14: ToObject

 public JSONObject ToObject()
 {
     var result = new JSONObject();
     result.AddValue("name", Text);
     result.AddValue("headline", Headline);
     result.AddValue("content", Content);
     result.AddValue("imageId", ImageId);
     return result;
 }
开发者ID:jeppe-andreasen,项目名称:LinqIt-Libraries,代码行数:9,代码来源:ImageGalleryData.cs

示例15: OnPreRender

        protected override void OnPreRender(EventArgs e)
        {
            var options = new JSONObject();
            options.AddValue("mode", "exact");
            if (Width.HasValue)
                options.AddValue("width", Width.Value.Value.ToString());
            else
                options.AddValue("width", 800);
            options.AddValue("elements", _textbox.ClientID);
            options.AddValue("convert_urls", false);
            options.AddValue("theme", "advanced");
            options.AddValue("plugins", GetPlugins());

            var styleOptions = GetStyleOptions();
            if (!string.IsNullOrEmpty(styleOptions))
                options.AddValue("theme_advanced_styles", styleOptions);
            options.AddValue("theme_advanced_buttons1", GetButtons1());
            options.AddValue("theme_advanced_buttons2", GetButtons2());
            options.AddValue("theme_advanced_buttons3", GetButtons3());
            options.AddValue("theme_advanced_toolbar_location", "top");
            options.AddValue("theme_advanced_toolbar_align", "left");
            options.AddValue("theme_advanced_statusbar_location", "bottom");
            options.AddValue("template_external_list_url", "lists/template_list.js");
            options.AddValue("external_link_list_url", "lists/link_list.js");
            options.AddValue("external_image_list_url", "lists/image_list.js");
            options.AddValue("media_external_list_url", "lists/media_list.js");

            if (StyleSheets != null && StyleSheets.Any())
                options.AddValue("content_css", StyleSheets.ToSeparatedString(","));

            options.AddValue("verify_html", false);
            options.AddValue("valid_elements", "*[*]");
            //options.AddValue("valid_elements", GetValidElements());
            options.AddValue("invalid_elements", GetInvalidElements());

            //options.AddValue("template_replace_values", JSONObject.Parse("{ username : \"Some User\", staffid : \"991234\" }"));

            var setup = new JSONDelegate("ed");
            if (!string.IsNullOrEmpty(HiddenId))
            {

                setup.Lines.Add("ed.onInit.add(function(ed, evt) {");
                setup.Lines.Add("initializeEditorValue(ed, doc, '" + HiddenId + "');");
                setup.Lines.Add("var dom = ed.dom;");
                setup.Lines.Add("var doc = ed.getDoc();");
                setup.Lines.Add("tinymce.dom.Event.add(doc, 'blur', function(e) {");
                setup.Lines.Add("updateEditorValue(ed, doc,'" + HiddenId + "');");
                setup.Lines.Add("});");
                setup.Lines.Add("});");
            }

            setup.Lines.Add("ed.onNodeChange.addToTop(function(ed, cm, n) {");
            setup.Lines.Add("var macroElement = ed.dom.getParent(ed.selection.getStart(), 'div.umbMacroHolder');");
            setup.Lines.Add("if (macroElement) {");
            setup.Lines.Add("ed.selection.select(macroElement);");
            setup.Lines.Add("var currentSelection = ed.selection.getStart();");
            setup.Lines.Add("if (tinymce.isIE) {");
            setup.Lines.Add("if (!ed.dom.hasClass(currentSelection, 'umbMacroHolder')) {");
            setup.Lines.Add("while (!ed.dom.hasClass(currentSelection, 'umbMacroHolder') && currentSelection.parentNode) {");
            setup.Lines.Add("currentSelection = currentSelection.parentNode;");
            setup.Lines.Add("}");
            setup.Lines.Add("ed.selection.select(currentSelection);");
            setup.Lines.Add("}");
            setup.Lines.Add("}");
            setup.Lines.Add("cm.setActive('umbracomacro', ed.dom.hasClass(currentSelection, 'umbMacroHolder') || ed.dom.hasClass(macroElement, 'umbMacroHolder'));");
            setup.Lines.Add("}");
            setup.Lines.Add("});");

            options.AddValue("setup", setup);

            var script = new StringBuilder();
            script.AppendLine("tinyMCE.init(" + options.ToString() + ");");

            if (RegisterFormBind)
                script.AppendLine("$(theForm).bind(\"onSave\", function() { $(\"#" + _textbox.ClientID + "\").val(tinyMCE.get('" + _textbox.ClientID + "').save()); });");

            Page.ClientScript.RegisterStartupScript(Page.GetType(), "tinyMCEditor" + _textbox.ClientID, script.ToString(), true);

            base.OnPreRender(e);
        }
开发者ID:cdrewery,项目名称:Umbraco-Public,代码行数:80,代码来源:TinyMCEditor.cs


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