Beispiel #1
0
        /// <summary>
        /// Serializes the asynchronous uploading settings to the writer.
        /// </summary>
        /// <param name="key">The serialization key.</param>
        /// <param name="options">The target dictionary.</param>
        public void SerializeTo(string key, IDictionary <string, object> options)
        {
            if (Save.HasValue())
            {
                Func <string, string> encoder = (string url) => upload.IsSelfInitialized ? HttpUtility.UrlDecode(url) : url;
                var config = new Dictionary <string, object>();

                config["saveUrl"] = encoder(Save.GenerateUrl(upload.ViewContext, upload.UrlGenerator));

                FluentDictionary.For(config)
                .Add("saveField", SaveField, () => SaveField.HasValue())
                .Add("removeField", RemoveField, () => RemoveField.HasValue())
                .Add("autoUpload", AutoUpload, () => AutoUpload.HasValue)
                .Add("batch", Batch, () => Batch.HasValue);

                if (Remove.HasValue())
                {
                    config["removeUrl"] = encoder(Remove.GenerateUrl(upload.ViewContext, upload.UrlGenerator));
                }

                options.Add(key, config);
            }
        }
Beispiel #2
0
 private void removeBtn_Click(object sender, EventArgs e)
 {
     RemoveField?.Invoke(this, Id, Key, Value);
 }