Esempio n. 1
0
        /// <summary>
        /// Saves the data-type PreValue options.
        /// </summary>
        public override void Save()
        {
            // set the options
            var options = new Options(true);

            options.Type = this.TextBoxType.Text;

            // parse the width
            int height, width;
            if (int.TryParse(this.TextBoxWidth.Text, out width))
            {
                if (width == 0)
                {
                    width = 425;
                }

                options.Width = width;
            }

            // parse the height
            if (int.TryParse(this.TextBoxHeight.Text, out height))
            {
                if (height == 0)
                {
                    height = 344;
                }

                options.Height = height;
            }

            // save the options as JSON
            this.SaveAsJson(options);
        }
Esempio n. 2
0
        /// <summary>
        /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param>
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // get PreValues, load them into the controls.
            var options = this.GetPreValueOptions<Options>();

            // no options? use the default ones.
            if (options == null)
            {
                options = new Options(true);
            }

            // set the values
            this.TextBoxType.Text = options.Type;
            this.TextBoxWidth.Text = options.Width.ToString();
            this.TextBoxHeight.Text = options.Height.ToString();
        }