ExecuteOnceWhenShown() public static method

public static ExecuteOnceWhenShown ( jQueryObject element, System.Action callback ) : void
element jQueryObject
callback System.Action
return void
Ejemplo n.º 1
0
        public GoogleMap(jQueryObject container, GoogleMapOptions opt)
            : base(container, opt)
        {
            var center = new LatLng(options.Latitude ?? 0, options.Longitude ?? 0);

            map = new Map(container[0], new MapOptions
            {
                Center      = center,
                MapTypeId   = options.MapTypeId ?? MapTypeId.roadmap,
                Zoom        = options.Zoom ?? 15,
                ZoomControl = true
            });

            if (options.MarkerTitle != null)
            {
                new Marker(new MarkerOptions {
                    Position = new LatLng(
                        options.MarkerLatitude ?? options.Latitude ?? 0,
                        options.MarkerLongitude ?? options.Longitude ?? 0),
                    Map       = map,
                    Title     = options.MarkerTitle,
                    Animation = Animation.Drop
                });
            }

            LazyLoadHelper.ExecuteOnceWhenShown(container, () =>
            {
                GEvent.Trigger(map, "resize");
                map.SetCenter(center); // in case it wasn't visible (e.g. in dialog)
            });
        }
Ejemplo n.º 2
0
        public Flexify(jQueryObject container, FlexifyOptions options)
            : base(container, options)
        {
            var self = this;

            LazyLoadHelper.ExecuteOnceWhenShown(container, delegate {
                self.StoreInitialSize();
            });
        }
        public HtmlContentEditor(jQueryObject textArea, HtmlContentEditorOptions opt)
            : base(textArea, opt)
        {
            IncludeCKEditor();

            string id = textArea.GetAttribute("id");

            if (id.IsTrimmedEmpty())
            {
                textArea.Attribute("id", this.uniqueName);
                id = this.uniqueName;
            }

            if (options.Cols != null)
            {
                textArea.Attribute("cols", options.Cols.Value.ToString());
            }

            if (options.Rows != null)
            {
                textArea.Attribute("rows", options.Rows.Value.ToString());
            }

            var self = this;

            this.AddValidationRule(this.uniqueName, e =>
            {
                if (e.HasClass("required"))
                {
                    var value = self.Value.TrimToNull();
                    if (value == null)
                    {
                        return(Q.Text("Validation.Required"));
                    }
                }

                return(null);
            });

            LazyLoadHelper.ExecuteOnceWhenShown(this.element, () =>
            {
                var config = GetConfig();
                CKEditor.Replace(id, config);
            });
        }