예제 #1
0
        protected override void Render(HtmlTextWriter writer)
        {
            controlToRender = JavascriptPage.CreateDiv(this.ID);

            foreach (MenuItem item in this.menuItems)
            {
            }
        }
예제 #2
0
 protected override void OnInit(EventArgs e)
 {
     if (Page is JavascriptPage && ((JavascriptPage)Page).FindJavascriptControls == false)
     {
         JavascriptPage page = (JavascriptPage)Page;
         page.AddJsonControl(this);
     }
     base.OnInit(e);
 }
예제 #3
0
        private static Control LoadControl(string virtualBoxPath, bool renderScripts, string requesterId, object injectionObject, bool postWindowLoad)
        {
            JavascriptPage controlLoader = new JavascriptPage();

            Control control = controlLoader.LoadControl(virtualBoxPath);
            //if (control.Controls.Count == 0)
            //    throw new UserControlIsNotBoxUserControlException(virtualBoxPath);

            BoxUserControl evolved = control as BoxUserControl;//control.Controls[0] as BoxUserControl;

            if (evolved == null)
            {
                throw new UserControlIsNotBoxUserControlException(virtualBoxPath);
            }

            Type controlType = control.GetType();

            JavascriptServer.RegisterProvider(controlType);// makes any JsonMethod methods available to the client

            controlLoader.Controls.Add(control);

            if (injectionObject != null)
            {
                MethodInfo boxInject = CustomAttributeExtension.GetFirstMethodWithAttributeOfType <BoxInject>(controlType);
                if (boxInject != null)
                {
                    ParameterInfo[] paramInfo = boxInject.GetParameters();
                    if (paramInfo.Length != 1 || paramInfo[0].ParameterType != injectionObject.GetType())
                    {
                        throw ExceptionHelper.CreateException <JsonInvalidOperationException>("The BoxInject method of control type {0} has the wrong type or number of parameters.", control.GetType().Name);
                    }

                    boxInject.Invoke(control, new object[] { injectionObject });
                }

                evolved.Inject(injectionObject);
            }

            MethodInfo boxInit = CustomAttributeExtension.GetFirstMethodWithAttributeOfType <BoxInit>(control.GetType());

            if (boxInit != null)
            {
                boxInit.Invoke(control, null);
            }

            evolved.PostBoxLoad(renderScripts, requesterId, postWindowLoad);
            //loadedControls.Add(virtualBoxPath, control);
            return(control);
        }
예제 #4
0
        /// <summary>
        /// This method is called by the BoxServer so the JsonControls can
        /// find each other and do their necessary wiring.
        /// </summary>
        /// <param name="renderScripts">true to render scripts.</param>
        internal void PostBoxLoad(bool renderScripts, string requesterId, bool postWindowLoad)
        {
            List <JsonControl> jsonControls = GetAllJsonControls(this.Page);
            JavascriptPage     page         = this.Page as JavascriptPage;

            foreach (JsonControl control in jsonControls)
            {
                if (!string.IsNullOrEmpty(requesterId.Trim()))
                {
                    control.DomId = string.Format("{0}_{1}", requesterId, control.DomId);
                }

                if (control is Box)
                {
                    throw new BoxValidationException(this.Parent.AppRelativeTemplateSourceDirectory);
                }

                control.RenderScripts  = renderScripts;
                control.PostWindowLoad = postWindowLoad;
                page.AddJsonControl(control);
            }
            page.WireJsonControls(false);
        }
예제 #5
0
        protected override void Render(System.Web.UI.HtmlTextWriter writer)
        {
            controlToRender.TagName = "div";
            controlToRender.Attributes.CssStyle.Add("display", "none");

            if (!string.IsNullOrEmpty(BoxCssClass))
            {
                controlToRender.Attributes.Add("class", BoxCssClass);
            }
            else
            {
                controlToRender.Style.Add("width", "450px");
                controlToRender.Style.Add("height", "250px");
                controlToRender.Style.Add("background-color", "#FFFFFF");
                controlToRender.Style.Add("border", "1px solid #000000");
            }

            controlToRender.ID = boxId;

            HtmlGenericControl title = new HtmlGenericControl("div");

            title.ID        = titleId;
            title.InnerHtml = Title;
            if (!string.IsNullOrEmpty(TitleCssClass))
            {
                title.Attributes.Add("class", TitleCssClass);
            }
            else
            {
                title.Style.Add("background-color", "#0000FF");
                title.Style.Add("border", "1px solid #000000");
                title.Style.Add("margin", "1px");
                title.Style.Add("padding", "3px");
            }



            controlToRender.Controls.Add(title);

            HtmlGenericControl messageText = JavascriptPage.CreateDiv(messageId);

            if (!string.IsNullOrEmpty(this.MessageCssClass))
            {
                messageText.Attributes.Add("class", MessageCssClass);
            }
            else
            {
                messageText.Style.Add("height", "175px");
            }

            controlToRender.Controls.Add(messageText);

            JsonFunction registration = new JsonFunction();

            registration.ExecutionType = JavascriptExecutionTypes.OnWindowLoad;
            string body = "\r\nif(MessageBox != 'undefined'){";

            body += string.Format("\tMessageBox.RegisterMessageBox('{0}','{1}','{2}');", boxId, titleId, messageId);
            body += "}";
            registration.FunctionBody = body;

            controlToRender.RenderControl(writer);
            registration.RenderControl(writer);

            //    <div id="messageDiv" style="display: none; border:1px solid black; background-color: White; width: 400px;" class="modal">
            //        <div id="messageDrag" style="background-color: #FFCC99; padding: 3px; border:1px solid black; "><b>Patterns Setup Message</b></div>
            //        <div id="messageText"></div><br /><br />
            //    </div>
        }
예제 #6
0
        private static Control LoadControl(string virtualBoxPath, bool renderScripts, string requesterId, object injectionObject, bool postWindowLoad)
        {
            JavascriptPage controlLoader = new JavascriptPage();

            Control control = controlLoader.LoadControl(virtualBoxPath);
            //if (control.Controls.Count == 0)
            //    throw new UserControlIsNotBoxUserControlException(virtualBoxPath);

            BoxUserControl evolved = control as BoxUserControl;//control.Controls[0] as BoxUserControl;
            if (evolved == null)
                throw new UserControlIsNotBoxUserControlException(virtualBoxPath);

            Type controlType = control.GetType();
            JavascriptServer.RegisterProvider(controlType);// makes any JsonMethod methods available to the client

            controlLoader.Controls.Add(control);

            if (injectionObject != null)
            {
                MethodInfo boxInject = CustomAttributeExtension.GetFirstMethodWithAttributeOfType<BoxInject>(controlType);
                if (boxInject != null)
                {
                    ParameterInfo[] paramInfo = boxInject.GetParameters();
                    if (paramInfo.Length != 1 || paramInfo[0].ParameterType != injectionObject.GetType())
                        throw ExceptionHelper.CreateException<JsonInvalidOperationException>("The BoxInject method of control type {0} has the wrong type or number of parameters.", control.GetType().Name);

                    boxInject.Invoke(control, new object[] { injectionObject });
                }

                evolved.Inject(injectionObject);
            }

            MethodInfo boxInit = CustomAttributeExtension.GetFirstMethodWithAttributeOfType<BoxInit>(control.GetType());
            if (boxInit != null)
                boxInit.Invoke(control, null);

            evolved.PostBoxLoad(renderScripts, requesterId, postWindowLoad);
            //loadedControls.Add(virtualBoxPath, control);
            return control;
        }
 public JavascriptResourceManager(JavascriptPage page)
     : this()
 {
     this.page = page;
     this.page.JavascriptResourceManager = this;
 }