Example #1
0
        /// <summary>
        /// Renders the list to the json definition for the client.
        /// </summary>
        /// <returns></returns>
        internal object Render()
        {
            lock (this)
            {
                object        config = null;
                IWisejControl chart  = this.owner;

                if (!chart.DesignMode)
                {
                    // render the full list?
                    bool isNew = (this.IsNew || chart.IsNew);
                    if (!isNew && !this.IsDirty)
                    {
                        return(null);
                    }
                }

                // reset the state of the list.
                this.IsNew   = false;
                this.IsDirty = false;

                config = this.list.ToArray();
                return(config);
            }
        }
Example #2
0
        /// <summary>
        /// Renders the client component.
        /// </summary>
        /// <param name="config">Dynamic configuration object.</param>
        protected override void OnWebRender(dynamic config)
        {
            base.OnWebRender((object)config);

            IWisejControl me = this;

            config.className = "wisej.web.ext.JustGage";

            config.title                = this.Text;
            config.value                = this.Value;
            config.label                = this.Label;
            config.symbol               = this.Symbol;
            config.minimum              = this.Minimum;
            config.maximum              = this.Maximum;
            config.showMinMax           = this.ShowMinMax;
            config.showPointer          = this.ShowPointer;
            config.reverse              = this.Reverse;
            config.showValue            = this.ShowValue;
            config.showDonut            = this.Donut;
            config.labelColor           = this.LabelColor;
            config.valueColor           = this.ValueColor;
            config.ShowGradient         = this.Gradient;
            config.borderStyle          = this.BorderStyle;
            config.customSectors        = this.CustomSectors;
            config.humanFriendly        = this.HumanFriendly;
            config.decimals             = this.Decimals;
            config.formatNumber         = this.FormatNumber;
            config.counter              = this.Counter;
            config.titlePosition        = this.TitlePosition;
            config.startAnimationType   = ConvertAnimationType(this.StartAnimationType);
            config.refreshAnimationType = ConvertAnimationType(this.RefreshAnimationType);
        }
Example #3
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);
        }
Example #4
0
        private int GetThemeLineWidth()
        {
            IWisejControl me    = this;
            int           width = me.Theme.GetProperty <int>(this.AppearanceKey, "lineWidth");

            return(width < 1 ? 5 : width);
        }
Example #5
0
        private string BuildInitScript()
        {
            IWisejControl me      = this;
            dynamic       options = new DynamicObject();
            string        script  = GetResourceString("Wisej.Web.Ext.jQueryKnob.JavaScript.startup.js");

            options.min             = this.MinValue;
            options.max             = this.MaxValue;
            options.value           = this.Value;
            options.step            = this.Step;
            options.thickness       = this.Thickness / 100d;
            options.angleArc        = this._angleArc;
            options.angleOffset     = this.AngleOffset;
            options.lineCap         = this.LineCapStyle;
            options.displayInput    = this.ShowInput;
            options.displayPrevious = this.DisplayPrevious;
            options.readOnly        = this.ReadOnly;
            options.font            = this.Font;
            options.fgColor         = this.ForeColor;
            options.bgColor         = this.BackColor;
            options.height          = options.width = Math.Min(this.Width, this.Height);
            options.cursor          =
                this.KnobType == KnobType.Gauge
                                        ? 0
                                        : this.CursorSize;

            script = script.Replace("$options", options.ToString());

            return(script);
        }
Example #6
0
        public override void Update()
        {
            IWisejControl me = this;

            if (me.IsNew)
            {
                if (this._commands != null)
                {
                    var enabled = this._commands.Where(o => o.Value == true).Select(o => o.Key);
                    if (enabled.Count() > 0)
                    {
                        Call("enableCommand", enabled, true);
                    }

                    var disabled = this._commands.Where(o => o.Value == false).Select(o => o.Key);
                    if (disabled.Count() > 0)
                    {
                        Call("enableCommand", disabled, false);
                    }
                }

                Call("setText", TextUtils.EscapeText(this.Text, true));
            }

            base.Update();
        }
Example #7
0
        /// <summary>
        /// Renders the client component.
        /// </summary>
        /// <param name="config">Dynamic configuration object.</param>
        protected override void OnWebRender(dynamic config)
        {
            base.OnWebRender((object)config);
            IWisejControl me = this;

            config.className   = "wisej.web.Control";
            config.borderStyle = this.BorderStyle;
        }
Example #8
0
        private string BuildInitScript()
        {
            IWisejControl me      = this;
            dynamic       options = new DynamicObject();
            string        script  = GetResourceString("Wisej.Web.Ext.Pannellum.JavaScript.startup.js");

            return(script);
        }
Example #9
0
        private string BuildInitScript()
        {
            IWisejControl me      = this;
            dynamic       options = new DynamicObject();
            string        script  = GetResourceString("Wisej.Web.Ext.XTerm.JavaScript.startup.js");

            options.DebugScript = DebugScript;
            script = script.Replace("$options", options.ToString());
            return(script);
        }
Example #10
0
        private string BuildInitScript()
        {
            IWisejControl me = this;

            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);
        }
Example #11
0
        /// <summary>
        /// Causes the chart to update the data set and labels.
        /// It performs a smooth animated transition from one data set to the new one.
        /// </summary>
        /// <param name="duration">Duration of the update animation in milliseconds. The default is 300 milliseconds.</param>
        public void UpdateData(int duration = 300)
        {
            // if the control is already scheduled for a full update, there is no
            // point in updating the dataset since it will be fully redrawn with the next update.
            IWisejControl me = this;

            if (me.IsDirty)
            {
                return;
            }

            Call("update", this.DataSets, this.Labels, duration);
        }
Example #12
0
        protected override void OnWebRender(dynamic config)
        {
            base.OnWebRender((object)config);
            IWisejControl me = this;

            if (!me.DesignMode)
            {
                config.backgroundImages = new
                {
                    layout = ImageLayout.Zoom,
                    image  = this.GetPostbackURL() + "&v=" + DateTime.Now.Ticks
                };
            }
        }
Example #13
0
        /// <summary>
        /// Renders the client component.
        /// </summary>
        /// <param name="config">Dynamic configuration object.</param>
        protected override void OnWebRender(dynamic config)
        {
            base.OnWebRender((object)config);
            IWisejControl me = this;

            config.className = "wisej.web.ext.PolymerWidget";

            config.events           = this.Events;
            config.properties       = this.Properties;
            config.elementType      = this.ElementType;
            config.borderStyle      = this.BorderStyle;
            config.elementClassName = this.ElementClassName;
            config.content          = TextUtils.EscapeText(this.Text, true);
            config.wiredEvents.Add("polymerEvent(Event)");
        }
Example #14
0
        private string BuildInitScript()
        {
            IWisejControl me      = this;
            dynamic       options = new DynamicObject();
            string        script  = GetResourceString("Wisej.Web.Ext.CKEditor.JavaScript.startup.js");

            options.config          = this.Options;
            options.fonts           = this.FontNames;
            options.showFooter      = this.ShowFooter;
            options.showToolbar     = this.ShowToolbar;
            options.externalPlugins = this.ExternalPlugins;
            script = script.Replace("$options", options.ToString());

            return(script);
        }
Example #15
0
        protected override void OnCreateControl()
        {
            // when in design mode, attach the paint handler
            // to render the chart on the design surface.
            // at runtime the chart is returned in the http response stream.

            IWisejControl me = this;

            if (me.DesignMode)
            {
                this.Paint += Chart_Paint;
            }

            base.OnCreateControl();
        }
        private string BuildInitScript()
        {
            IWisejControl me      = this;
            dynamic       options = new DynamicObject();
            string        script  = GetResourceString("Wisej.Web.Ext.TinyEditor.JavaScript.startup.js");

            options.sourceText  = this.SourceText;
            options.wysiwygText = this.WysiwygText;
            options.cssfile     = GetResourceURL("Wisej.Web.Ext.TinyEditor.Resources.tiny.editor.css");
            options.fonts       = this.FontNames;
            options.controls    = this.Toolbar;
            options.header      = this.ShowToolbar;
            options.footer      = this.ShowFooter;
            options.cssfile     = this.StyleSheetSource;
            script = script.Replace("$options", options.ToString());

            return(script);
        }
Example #17
0
        public override void Update()
        {
            IWisejControl me = this;

            if (me.IsNew && this._commands != null)
            {
                var enabled = this._commands.Where(o => o.Value == true).Select(o => o.Key);
                if (enabled.Count() > 0)
                {
                    Call("enableCommand", enabled, true);
                }

                var disabled = this._commands.Where(o => o.Value == false).Select(o => o.Key);
                if (disabled.Count() > 0)
                {
                    Call("enableCommand", disabled, false);
                }
            }

            base.Update();
        }
Example #18
0
        private Color GetThemeLabelColor()
        {
            IWisejControl me = this;

            return(me.Theme.GetColor("labelColor"));
        }
Example #19
0
        private Color GetThemeBackColor()
        {
            IWisejControl me = this;

            return(me.Theme.GetColor(this.AppearanceKey, "backgroundColor"));
        }
Example #20
0
        private Color GetThemeValueColor()
        {
            IWisejControl me = this;

            return(me.Theme.GetColor("valueColor"));
        }