コード例 #1
0
        private void RenderOpeningBodyElement(XhtmlMobileTextWriter writer)
        {
            Form  activeForm = Page.ActiveForm;
            Style formStyle  = ((ControlAdapter)activeForm.Adapter).Style;

            if (CssLocation == StyleSheetLocation.PhysicalFile)
            {
                String cssClass = (String)activeForm.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
                writer.WriteBeginTag("body");
                if (cssClass != null && (String)Device["supportsBodyClassAttribute"] != "false")
                {
                    writer.WriteAttribute("class", cssClass, true /* encode */);
                    writer.PushPhysicalCssClass(cssClass);
                    _pushedCssClassForBody = true;
                }
                writer.Write(">");
            }
            else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
                     (String)Device[XhtmlConstants.SupportsBodyClassAttribute] != "false")
            {
                writer.EnterStyle(formStyle, "body");
            }
            else
            {
                writer.WriteFullBeginTag("body");
                if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
                    (String)Device[XhtmlConstants.SupportsBodyClassAttribute] == "false")
                {
                    writer.SetBodyStyle(formStyle);
                }
            }
        }
コード例 #2
0
        /////////////////////////////////////////////////////////////////////////
        // SPECIALIZED UTILITY METHODS FOR LIST SELECTIONLIST OBJECTLIST
        /////////////////////////////////////////////////////////////////////////

        // tagname can be any of table, ul, ol.  See the list adapters for examples.
        /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderOpeningListTag"]/*' />
        protected virtual void RenderOpeningListTag(XhtmlMobileTextWriter writer, String tagName)
        {
            String classAttribute = (String)Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];

            if (CssLocation == StyleSheetLocation.PhysicalFile && (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true")
            {
                writer.WritePendingBreak();
                writer.WriteBeginTag(tagName);
                if (classAttribute != null &&
                    classAttribute.Length > 0 &&
                    writer.DiffersFromCurrentPhysicalCssClass(classAttribute))
                {
                    writer.WriteAttribute("class", classAttribute, true);
                    writer.PushPhysicalCssClass(classAttribute);
                    Debug.Assert(!_physicalCssClassPushed, "These calls should not be nested.");
                    _physicalCssClassPushed = true;
                }
                writer.Write(">");
            }
            else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true")
            {
                writer.WritePendingBreak();
                StyleFilter filter = writer.CurrentStyleClass.GetFilter(Style);
                writer.EnterStyle(new XhtmlFormatStyleClass(Style, filter), tagName);
            }
            else
            {
                writer.WritePendingBreak();
                writer.WriteFullBeginTag(tagName);
            }
        }
コード例 #3
0
 /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalEnterStyle1"]/*' />
 protected virtual void ConditionalEnterStyle(XhtmlMobileTextWriter writer, Style style, String tag)
 {
     if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] == "true")
     {
         return;
     }
     if (CssLocation == StyleSheetLocation.PhysicalFile)
     {
         // Do nothing.  Styles should be handled by CssClass custom attribute.
         return;
     }
     if (tag == null || tag.Length == 0)
     {
         writer.EnterStyle(style);
     }
     else
     {
         writer.EnterStyle(style, tag);
     }
 }
コード例 #4
0
        /////////////////////////////////////////////////////////////////////////
        // SPECIALIZED UTILITY METHODS FOR LIST SELECTIONLIST OBJECTLIST
        /////////////////////////////////////////////////////////////////////////

        // tagname can be any of table, ul, ol.  See the list adapters for examples.
        /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.RenderOpeningListTag"]/*' />
        protected virtual void RenderOpeningListTag(XhtmlMobileTextWriter writer, String tagName) {            
            String classAttribute = (String) Control.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
            if (CssLocation == StyleSheetLocation.PhysicalFile && (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true") {
                writer.WritePendingBreak();
                writer.WriteBeginTag(tagName);            
                if (classAttribute != null && 
                    classAttribute.Length > 0 &&
                    writer.DiffersFromCurrentPhysicalCssClass(classAttribute)) {
                    writer.WriteAttribute("class", classAttribute, true);
                    writer.PushPhysicalCssClass(classAttribute);
                    Debug.Assert(!_physicalCssClassPushed, "These calls should not be nested.");
                    _physicalCssClassPushed = true;
                }
                writer.Write(">");
            }
            else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true") {
                writer.WritePendingBreak();
                StyleFilter filter = writer.CurrentStyleClass.GetFilter(Style);
                writer.EnterStyle(new XhtmlFormatStyleClass(Style, filter), tagName);
            }
            else {
                writer.WritePendingBreak();
                writer.WriteFullBeginTag(tagName);
            }
        }
コード例 #5
0
        /// <include file='doc\XhtmlBasicControlAdapter.uex' path='docs/doc[@for="XhtmlControlAdapter.ConditionalEnterStyle1"]/*' />
        protected virtual void ConditionalEnterStyle(XhtmlMobileTextWriter writer, Style style, String tag) {
            if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] == "true") {
                return;
            }
            if (CssLocation == StyleSheetLocation.PhysicalFile) {
                // Do nothing.  Styles should be handled by CssClass custom attribute.
                return;
            }
            if (tag == null || tag.Length == 0) {
                writer.EnterStyle(style);
            }
            else {
                writer.EnterStyle(style, tag);
            }

        }
コード例 #6
0
        /// <include file='doc\XhtmlBasicFormAdapter.uex' path='docs/doc[@for="XhtmlFormAdapter.Render"]/*' />
        public override void Render (XhtmlMobileTextWriter writer) {
            // Note: <head>, <body> rendered by page adapter, as in HTML case.
            String formsAuthCookieName = FormsAuthentication.FormsCookieName;
            if(!Device.SupportsRedirectWithCookie)
            {
                if(formsAuthCookieName != null && formsAuthCookieName.Length > 0)
                {
                    HttpContext.Current.Response.Cookies.Remove(formsAuthCookieName);
                }
            }
            writer.WriteBeginTag ("form");
            writer.WriteAttribute ("id", Control.ClientID);
            writer.WriteAttribute ("method", Control.Method.ToString().ToLower(CultureInfo.CurrentCulture));
            writer.Write (" action=\"");
            RenderPostbackUrl(writer);
            if(Control.Action.Length > 0) {
                if(Control.Action.IndexOf("?", StringComparison.Ordinal) != -1) {
                    writer.Write("&");
                }
                else {
                    writer.Write("?");
                }
            }
            else {
                writer.Write("?");
            }
            writer.Write(Page.UniqueFilePathSuffix);

            if (Control.Method != FormMethod.Get &&
                Control.Action.Length == 0) {   // VSWhidbey 411176: We don't include QueryStringText if Action is explicitly set

                String queryStringText = PreprocessQueryString(Page.QueryStringText);
                if (queryStringText != null && queryStringText.Length > 0) {
                    String amp = (String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false"  ? "&amp;" : "&";
                    writer.Write(amp);
                    if((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false") {
                        writer.WriteEncodedText(queryStringText);
                    }
                    else {
                        writer.Write(queryStringText);
                    }
                }
            }
            writer.WriteLine ("\">");
            bool needDivStyle = (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
                (String)Device["supportsBodyClassAttribute"] == "false";
            if (!needDivStyle) {
                if((String)Device["usePOverDiv"] == "true")
                    writer.WriteFullBeginTag("p");
                else
                    writer.WriteFullBeginTag ("div");
            }
            else {
                if((String)Device["usePOverDiv"] == "true")
                    writer.EnterStyle(Style, "p");
                else
                    writer.EnterStyle (Style, "div");
            }
            RenderPostBackHeader (writer);
            // Renders hidden variables for IPostBackDataHandlers which are
            // not displayed due to pagination or secondary UI.
            RenderOffPageVariables(writer, Control, Control.CurrentPage);
            
            RenderChildren (writer);
            if (!needDivStyle) {
                if((String)Device["usePOverDiv"] == "true")
                    writer.WriteEndTag("p");
                else
                    writer.WriteEndTag ("div");
            }
            else {
                if((String)Device["usePOverDiv"] == "true")
                    writer.ExitStyle(Style);
                else
                    writer.ExitStyle (Style);
            }
            writer.WriteEndTag ("form");
        }
コード例 #7
0
 private void RenderOpeningBodyElement(XhtmlMobileTextWriter writer) {
     Form activeForm = Page.ActiveForm;
     Style formStyle = ((ControlAdapter)activeForm.Adapter).Style;
     if (CssLocation == StyleSheetLocation.PhysicalFile) {
         String cssClass = (String) activeForm.CustomAttributes[XhtmlConstants.CssClassCustomAttribute];
         writer.WriteBeginTag("body");
         if (cssClass != null  && (String)Device["supportsBodyClassAttribute"] != "false") {
             writer.WriteAttribute("class", cssClass, true /* encode */);
             writer.PushPhysicalCssClass(cssClass);
             _pushedCssClassForBody = true;
         }
         writer.Write(">");
     }
     else if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
         (String)Device[XhtmlConstants.SupportsBodyClassAttribute] != "false") {
         writer.EnterStyle(formStyle, "body");
     }
     else {
         writer.WriteFullBeginTag("body");    
         if ((String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
             (String)Device[XhtmlConstants.SupportsBodyClassAttribute] == "false") {
             writer.SetBodyStyle(formStyle);
         }
     }
 }
コード例 #8
0
        /// <include file='doc\XhtmlBasicFormAdapter.uex' path='docs/doc[@for="XhtmlFormAdapter.Render"]/*' />
        public override void Render(XhtmlMobileTextWriter writer)
        {
            // Note: <head>, <body> rendered by page adapter, as in HTML case.
            String formsAuthCookieName = FormsAuthentication.FormsCookieName;

            if (!Device.SupportsRedirectWithCookie)
            {
                if (formsAuthCookieName != null && formsAuthCookieName.Length > 0)
                {
                    HttpContext.Current.Response.Cookies.Remove(formsAuthCookieName);
                }
            }
            writer.WriteBeginTag("form");
            writer.WriteAttribute("id", Control.ClientID);
            writer.WriteAttribute("method", Control.Method.ToString().ToLower(CultureInfo.CurrentCulture));
            writer.Write(" action=\"");
            RenderPostbackUrl(writer);
            if (Control.Action.Length > 0)
            {
                if (Control.Action.IndexOf("?", StringComparison.Ordinal) != -1)
                {
                    writer.Write("&");
                }
                else
                {
                    writer.Write("?");
                }
            }
            else
            {
                writer.Write("?");
            }
            writer.Write(Page.UniqueFilePathSuffix);

            if (Control.Method != FormMethod.Get &&
                Control.Action.Length == 0)     // VSWhidbey 411176: We don't include QueryStringText if Action is explicitly set

            {
                String queryStringText = PreprocessQueryString(Page.QueryStringText);
                if (queryStringText != null && queryStringText.Length > 0)
                {
                    String amp = (String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false"  ? "&amp;" : "&";
                    writer.Write(amp);
                    if ((String)Device[XhtmlConstants.SupportsUrlAttributeEncoding] != "false")
                    {
                        writer.WriteEncodedText(queryStringText);
                    }
                    else
                    {
                        writer.Write(queryStringText);
                    }
                }
            }
            writer.WriteLine("\">");
            bool needDivStyle = (String)Device[XhtmlConstants.RequiresXhtmlCssSuppression] != "true" &&
                                (String)Device["supportsBodyClassAttribute"] == "false";

            if (!needDivStyle)
            {
                if ((String)Device["usePOverDiv"] == "true")
                {
                    writer.WriteFullBeginTag("p");
                }
                else
                {
                    writer.WriteFullBeginTag("div");
                }
            }
            else
            {
                if ((String)Device["usePOverDiv"] == "true")
                {
                    writer.EnterStyle(Style, "p");
                }
                else
                {
                    writer.EnterStyle(Style, "div");
                }
            }
            RenderPostBackHeader(writer);
            // Renders hidden variables for IPostBackDataHandlers which are
            // not displayed due to pagination or secondary UI.
            RenderOffPageVariables(writer, Control, Control.CurrentPage);

            RenderChildren(writer);
            if (!needDivStyle)
            {
                if ((String)Device["usePOverDiv"] == "true")
                {
                    writer.WriteEndTag("p");
                }
                else
                {
                    writer.WriteEndTag("div");
                }
            }
            else
            {
                if ((String)Device["usePOverDiv"] == "true")
                {
                    writer.ExitStyle(Style);
                }
                else
                {
                    writer.ExitStyle(Style);
                }
            }
            writer.WriteEndTag("form");
        }