Пример #1
0
        public JuiceWidgetState(IWidget widget)
        {
            Widget = widget;

            foreach(EventDescriptor widgetEvent in TypeDescriptor.GetEvents(Widget.GetType()).OfType<EventDescriptor>()) {

                WidgetEventAttribute attribute = widgetEvent.Attributes.OfType<WidgetEventAttribute>().SingleOrDefault();

                if(attribute != null && attribute.DataChangedHandler == true) {
                    _dataChangedEvent = new WidgetEvent(attribute.Name);
                    break;
                }
            }

            _cssManager = new CssManager(widget as Control);
        }
Пример #2
0
        public JuiceWidgetState(IWidget widget)
        {
            Widget = widget;

            foreach (EventDescriptor widgetEvent in TypeDescriptor.GetEvents(Widget.GetType()).OfType <EventDescriptor>())
            {
                WidgetEventAttribute attribute = widgetEvent.Attributes.OfType <WidgetEventAttribute>().SingleOrDefault();

                if (attribute != null && attribute.DataChangedHandler == true)
                {
                    _dataChangedEvent = new WidgetEvent(attribute.Name);
                    break;
                }
            }

            _cssManager = new CssManager(widget as Control);
        }
Пример #3
0
        private void ParseEvents()
        {
            // Add widget events from control type declaration
            _events.AddRange(
                    from widgetEvent in TypeDescriptor.GetAttributes(Widget).OfType<WidgetEventAttribute>()
                    select new WidgetEvent(widgetEvent.Name)
            );

            IAutoPostBackWidget autoPostBackWidget = Widget as IAutoPostBackWidget;
            Boolean autoPostBack = autoPostBackWidget == null ? false : autoPostBackWidget.AutoPostBack;

            // Add widget events from control events
            foreach(EventDescriptor widgetEvent in TypeDescriptor.GetEvents(Widget.GetType()).OfType<EventDescriptor>()) {

                WidgetEventAttribute attribute = widgetEvent.Attributes.OfType<WidgetEventAttribute>().SingleOrDefault();

                if(attribute == null) {
                    continue;
                }

                WidgetEvent @event = new WidgetEvent(attribute.Name);

                @event.CausesPostBack = attribute.AutoPostBack && autoPostBack;
                @event.DataChangedEvent = _dataChangedEvent != null && _dataChangedEvent.Name == @event.Name;

                //String postBackArgument = _dataChangedEvent == null ? @event.Name : (_dataChangedEvent.Name == @event.Name ? String.Empty : @event.Name);

                //PostBackOptions postOptions = new PostBackOptions((Control)Widget, postBackArgument) { AutoPostBack = true };
                //var handler = new Lazy<string>(() => Widget.Page.ClientScript.GetPostBackEventReference(postOptions));

                //@event.PostBackHandler = handler;

                _events.Add(@event);
            }
        }
Пример #4
0
        private void ParseEvents()
        {
            // Add widget events from control type declaration
            _events.AddRange(
                    from widgetEvent in TypeDescriptor.GetAttributes(Widget).OfType<WidgetEventAttribute>()
                    select new WidgetEvent(widgetEvent.Name)
            );

            IAutoPostBackWidget autoPostBackWidget = Widget as IAutoPostBackWidget;
            Boolean autoPostBack = autoPostBackWidget == null ? false : autoPostBackWidget.AutoPostBack;

            // Add widget events from control events
            foreach(EventDescriptor widgetEvent in TypeDescriptor.GetEvents(Widget.GetType()).OfType<EventDescriptor>()) {

                WidgetEventAttribute attribute = widgetEvent.Attributes.OfType<WidgetEventAttribute>().SingleOrDefault();

                if(attribute == null) {
                    continue;
                }

                WidgetEvent @event = new WidgetEvent(attribute.Name);

                @event.CausesPostBack = attribute.AutoPostBack && autoPostBack;
                @event.DataChangedEvent = _dataChangedEvent != null && _dataChangedEvent.Name == @event.Name;

                _events.Add(@event);
            }
        }