protected virtual void RenderPager(WmlMobileTextWriter writer) { PagerStyle pagerStyle = Control.PagerStyle; int pageCount = Control.PageCount; if (pageCount <= 1) { return; } int page = Control.CurrentPage; writer.EnterStyle(pagerStyle); if (page < pageCount) { String nextPageText = pagerStyle.GetNextPageText(page); RenderPostBackEvent(writer, (page + 1).ToString(), writer.IsValidSoftkeyLabel(nextPageText) ? nextPageText : GetDefaultLabel(NextLabel), true, nextPageText, true); } if (page > 1) { String prevPageText = pagerStyle.GetPreviousPageText(page); RenderPostBackEvent(writer, (page - 1).ToString(), writer.IsValidSoftkeyLabel(prevPageText) ? prevPageText : GetDefaultLabel(PreviousLabel), true, prevPageText, true); } writer.ExitStyle(pagerStyle); }
/// <include file='doc\WmlControlAdapter.uex' path='docs/doc[@for="WmlControlAdapter.RenderPostBackEvent1"]/*' /> protected void RenderPostBackEvent( WmlMobileTextWriter writer, String argument, String softkeyLabel, bool mapToSoftkey, String text, bool breakAfter, WmlPostFieldType postBackType) { bool implicitSoftkeyLabel = false; if (mapToSoftkey) { if (softkeyLabel == null || softkeyLabel.Length == 0) { softkeyLabel = text; implicitSoftkeyLabel = true; } if (!writer.IsValidSoftkeyLabel(softkeyLabel)) { // If softkey label was specified explicitly, then truncate. if (!implicitSoftkeyLabel && softkeyLabel.Length > 0) { softkeyLabel = softkeyLabel.Substring(0, Device.MaximumSoftkeyLabelLength); } else { softkeyLabel = GetDefaultLabel(GoLabel); implicitSoftkeyLabel = true; } } } writer.RenderBeginPostBack(softkeyLabel, implicitSoftkeyLabel, mapToSoftkey); writer.RenderText(text); writer.RenderEndPostBack(Control.UniqueID, argument, postBackType, true, breakAfter); }
public override void Render(WmlMobileTextWriter writer) { String text, url, phoneNumber; String controlText = Control.Text; // Always strip off optional separators for PhoneNumber before it // is added in markup. String originalNumber = Control.PhoneNumber; char[] plainNumber = new char[originalNumber.Length]; // allocate enough buffer size // Loop to strip out optional separators int sizeOfPlainNumber = 0; foreach (char ch in originalNumber) { if ((ch >= '0' && ch <= '9') || ch == '+') { plainNumber[sizeOfPlainNumber] = ch; sizeOfPlainNumber++; } } // Assign the number string with the right size phoneNumber = new String(plainNumber, 0, sizeOfPlainNumber); // Construct text and url based on device capabilities // if (!Device.CanInitiateVoiceCall) { text = String.Format(Control.AlternateFormat, controlText, originalNumber); url = Control.AlternateUrl; } else { // Some WML browsers require the phone number // showing as text so it can be selected. If it is not // formatted in the text yet, append it to the end of the // text. if (Device.RequiresPhoneNumbersAsPlainText) { text = controlText + " " + phoneNumber; url = String.Empty; } else { text = (controlText != String.Empty) ? controlText : originalNumber; url = "wtai://wp/mc;" + phoneNumber; } } // Write out plain text or corresponding link/softkey command // accordingly // writer.EnterStyle(Style); if (url.Length == 0) { writer.RenderText(text, Control.BreakAfter); } else { String softkeyLabel = Control.SoftkeyLabel; bool implicitSoftkeyLabel = false; if (softkeyLabel.Length == 0) { implicitSoftkeyLabel = true; softkeyLabel = text; } if (!writer.IsValidSoftkeyLabel(softkeyLabel)) { if (!implicitSoftkeyLabel && softkeyLabel.Length > 0) { softkeyLabel = softkeyLabel.Substring(0, Device.MaximumSoftkeyLabelLength); } else { implicitSoftkeyLabel = true; softkeyLabel = GetDefaultLabel(CallLabel); } } RenderBeginLink(writer, url, softkeyLabel, implicitSoftkeyLabel, true); writer.RenderText(text); RenderEndLink(writer, url, Control.BreakAfter); } writer.ExitStyle(Style); }
/// <include file='doc\WmlPhoneCallAdapter.uex' path='docs/doc[@for="WmlPhoneCallAdapter.Render"]/*' /> public override void Render(WmlMobileTextWriter writer) { String text, url, phoneNumber; String controlText = Control.Text; // Always strip off optional separators for PhoneNumber before it // is added in markup. String originalNumber = Control.PhoneNumber; char[] plainNumber = new char[originalNumber.Length]; // allocate enough buffer size // Loop to strip out optional separators int sizeOfPlainNumber = 0; foreach (char ch in originalNumber) { if ((ch >= '0' && ch <= '9') || ch == '+') { plainNumber[sizeOfPlainNumber] = ch; sizeOfPlainNumber++; } } // Assign the number string with the right size phoneNumber = new String(plainNumber, 0, sizeOfPlainNumber); // Construct text and url based on device capabilities // if (!Device.CanInitiateVoiceCall) { text = String.Format(CultureInfo.InvariantCulture, Control.AlternateFormat, controlText, originalNumber); url = Control.AlternateUrl; } else { // Some WML browsers require the phone number // showing as text so it can be selected. If it is not // formatted in the text yet, append it to the end of the // text. if(Device.RequiresPhoneNumbersAsPlainText) { text = controlText + " " + phoneNumber; url = String.Empty; } else { text = (controlText == null || controlText.Length > 0) ? controlText : originalNumber; url = "wtai://wp/mc;" + phoneNumber; } } // Write out plain text or corresponding link/softkey command // accordingly // writer.EnterStyle(Style); if (url.Length == 0) { writer.RenderText(text, Control.BreakAfter); } else { String softkeyLabel = Control.SoftkeyLabel; bool implicitSoftkeyLabel = false; if (softkeyLabel.Length == 0) { implicitSoftkeyLabel = true; softkeyLabel = text; } if (!writer.IsValidSoftkeyLabel(softkeyLabel)) { if (!implicitSoftkeyLabel && softkeyLabel.Length > 0) { softkeyLabel = softkeyLabel.Substring(0, Device.MaximumSoftkeyLabelLength); } else { implicitSoftkeyLabel = true; softkeyLabel = GetDefaultLabel(CallLabel); } } RenderBeginLink(writer, url, softkeyLabel, implicitSoftkeyLabel, true); writer.RenderText(text); RenderEndLink(writer, url, Control.BreakAfter); } writer.ExitStyle(Style); }
/// <include file='doc\WmlControlAdapter.uex' path='docs/doc[@for="WmlControlAdapter.RenderBeginLink"]/*' /> protected void RenderBeginLink(WmlMobileTextWriter writer, String targetUrl, String softkeyLabel, bool implicitSoftkeyLabel, bool mapToSoftkey) { if (mapToSoftkey && !writer.IsValidSoftkeyLabel(softkeyLabel)) { // If softkey label was specified explicitly, then truncate. if (!implicitSoftkeyLabel && softkeyLabel.Length > 0) { softkeyLabel = softkeyLabel.Substring(0, Device.MaximumSoftkeyLabelLength); } else { softkeyLabel = GetDefaultLabel(LinkLabel); implicitSoftkeyLabel = true; } } String postback = DeterminePostBack(targetUrl); if (postback != null) { writer.RenderBeginPostBack(softkeyLabel, implicitSoftkeyLabel, mapToSoftkey); } else { String prefix = Constants.FormIDPrefix; if (targetUrl.StartsWith(prefix, StringComparison.Ordinal)) { String formID = targetUrl.Substring(prefix.Length); Form form = Control.ResolveFormReference(formID); targetUrl = prefix + form.ClientID; } else { bool absoluteUrl = ((targetUrl.StartsWith("http:", StringComparison.Ordinal)) || (targetUrl.StartsWith("https:", StringComparison.Ordinal))); // AUI 3652 targetUrl = Control.ResolveUrl(targetUrl); bool queryStringWritten = targetUrl.IndexOf('?') != -1; IDictionary dictionary = PageAdapter.CookielessDataDictionary; String formsAuthCookieName = FormsAuthentication.FormsCookieName; if ((dictionary != null) && (!absoluteUrl) && (Control.MobilePage.Adapter.PersistCookielessData)) { StringBuilder sb = new StringBuilder(targetUrl); foreach (String name in dictionary.Keys) { if (queryStringWritten) { sb.Append("&"); } else { sb.Append("?"); queryStringWritten = true; } if (name.Equals(formsAuthCookieName) && Device.CanRenderOneventAndPrevElementsTogether) { sb.Append(name); sb.Append("=$("); sb.Append(writer.MapClientIDToShortName("__facn", false)); sb.Append(")"); } else { sb.Append(name); sb.Append("="); sb.Append(dictionary[name]); } } targetUrl = sb.ToString(); } } writer.RenderBeginHyperlink(targetUrl, false, softkeyLabel, implicitSoftkeyLabel, mapToSoftkey); } }