Ejemplo n.º 1
0
        private string BuildInitScript()
        {
            IWisejControl me     = this;
            dynamic       config = new DynamicObject();
            string        script = GetResourceString("Wisej.Web.Ext.ChartJS.JavaScript.startup.js");

            config.type = this.ChartType;

            // the power of Wisej is all in the next two lines.
            // options and data are complex objects, with nested objects, arrays and
            // enumerations. we simply assign them to config and they will be picked
            // up by the javascript widget without any complex transformations.

            config.options = this.Options;

            config.data = new
            {
                labels   = this.Labels,
                datasets =
                    ShouldSerializeDataSets()
                                                ? this.DataSets
                                                : this.DesignMode
                                                        ? this.DesignDataSets
                                                        : null
            };

            script = script.Replace("$config", WisejSerializer.Serialize(config, WisejSerializerOptions.IgnoreNulls | WisejSerializerOptions.CamelCase));
            return(script);
        }
        private string BuildInitScript()
        {
            string script = GetResourceString("Wisej.Web.Ext.GoogleMaps.JavaScript.startup.js");

            script = script.Replace("$options", WisejSerializer.Serialize(this.Options));
            script = script.Replace("$error", String.IsNullOrEmpty(this.ApiKey) ? "Missing Google Maps API Key" : "");

            return(script);
        }
Ejemplo n.º 3
0
        bool IWisejSerializable.Serialize(TextWriter writer, WisejSerializerOptions options)
        {
            writer.Write(
                WisejSerializer.Serialize(new
            {
                dow   = this.Days?.Select(d => (int)d),
                start = this.Start.ToString(),
                end   = this.End.ToString()
            })
                );

            return(true);
        }