private void BeginNextCard() { if (AnalyzeMode) { // Add a softkey on the current card, to go to the new card. String nextCardId = "card" + (_currentCardIndex + 1).ToString(CultureInfo.InvariantCulture); UpHyperlinkSoftkey softkey = new UpHyperlinkSoftkey(); softkey.TargetUrl = "#" + nextCardId; softkey.EncodeUrl = false; softkey.Label = "OK"; SetPrimarySoftkey(softkey); CurrentCard.AnchorCount = _currentCardAnchorCount; UpCard card = AllocateNewCard(); card.Id = nextCardId; _currentCardIndex++; } else { RenderCardClosing(_currentCardIndex); CloseParagraph(); WriteEndTag("card"); WriteLine(); _currentCardIndex++; _lastAlignment = Alignment.Left; _lastWrapping = Wrapping.NoWrap; WriteBeginTag("card"); WriteAttribute("id", CurrentCard.Id); String formTitle = CurrentForm.Title; if (formTitle != null && formTitle.Length > 0) { WriteTextEncodedAttribute("title", formTitle); } WriteLine(">"); RenderCardOpening(_currentCardIndex); } _currentCardAnchorCount = 0; _currentCardPostBacks = 0; _currentCardSubmits = 0; }
private void RenderSoftkey(String doType, UpSoftkey softkey) { UpHyperlinkSoftkey linkSoftkey = softkey as UpHyperlinkSoftkey; if (linkSoftkey != null) { WriteBeginTag("do"); WriteAttribute("type", doType); WriteTextEncodedAttribute("label", linkSoftkey.Label); Write(">"); WriteBeginTag("go"); Write(" href=\""); if (linkSoftkey.EncodeUrl) { WriteEncodedUrl(linkSoftkey.TargetUrl); } else { Write(EscapeAmpersand(linkSoftkey.TargetUrl)); } Write("\" />"); WriteEndTag("do"); return; } UpPostBackSoftkey postBackSoftkey = softkey as UpPostBackSoftkey; if (postBackSoftkey != null) { RenderDoEvent(doType, postBackSoftkey.Target, postBackSoftkey.Argument, postBackSoftkey.PostBackType, postBackSoftkey.Label, postBackSoftkey.IncludeVariables); return; } }
/// <include file='doc\UpWmlMobileTextWriter.uex' path='docs/doc[@for="UpWmlMobileTextWriter.RenderEndHyperlink"]/*' /> public override void RenderEndHyperlink(bool breakAfter) { if (!_inHyperlink) { throw new Exception(); } _inHyperlink = false; if (AnalyzeMode) { CheckRawOutput(); if (CurrentCard.MenuCandidate) { CurrentCard.RenderAsMenu = true; } CurrentCard.HasNonStaticElements = true; if (_inSoftkey) { // Add a softkey if possible. _inSoftkey = false; UpHyperlinkSoftkey softkey = new UpHyperlinkSoftkey(); softkey.TargetUrl = _targetUrl; softkey.EncodeUrl = _encodeUrl; if (_softkeyLabel == null || _softkeyLabel.Length == 0) { _softkeyLabel = _linkText; } softkey.Label = _softkeyLabel; CurrentCard.Softkeys[CurrentCard.SoftkeysUsed++] = softkey; } } else { if (CurrentCard.RenderAsMenu) { Write("<option onpick=\""); if (_targetUrl.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal)) { // no encoding needed if pointing to another form id Write(_targetUrl); } else if (!_encodeUrl) { Write(EscapeAmpersand(_targetUrl)); } else { WriteEncodedUrl(_targetUrl); } Write("\""); if (_useMenuOptionTitle && IsValidSoftkeyLabel(_softkeyLabel)) { WriteTextEncodedAttribute("title", _softkeyLabel); } Write(">"); WriteEncodedText(_linkText); WriteEndTag("option"); } else if (!CurrentCard.UsesDefaultSubmit) { base.RenderEndHyperlink(breakAfter); } } _currentCardAnchorCount++; if (!AnalyzeMode && _currentCardAnchorCount == CurrentCard.AnchorCount && _currentCardIndex < _cards.Count - 1) { BeginNextCard(); } }
private void BeginNextCard() { if (AnalyzeMode) { // Add a softkey on the current card, to go to the new card. String nextCardId = "card" + (_currentCardIndex + 1).ToString(CultureInfo.InvariantCulture); UpHyperlinkSoftkey softkey = new UpHyperlinkSoftkey(); softkey.TargetUrl = "#" + nextCardId; softkey.EncodeUrl = false; softkey.Label = "OK"; SetPrimarySoftkey(softkey); CurrentCard.AnchorCount = _currentCardAnchorCount; UpCard card = AllocateNewCard(); card.Id = nextCardId; _currentCardIndex++; } else { RenderCardClosing(_currentCardIndex); CloseParagraph(); WriteEndTag("card"); WriteLine(); _currentCardIndex++; _lastAlignment = Alignment.Left; _lastWrapping = Wrapping.NoWrap; WriteBeginTag("card"); WriteAttribute("id", CurrentCard.Id); String formTitle = CurrentForm.Title; if (formTitle != null && formTitle.Length > 0) { WriteTextEncodedAttribute("title", formTitle); } WriteLine(">"); RenderCardOpening(_currentCardIndex); } _currentCardAnchorCount = 0; _currentCardPostBacks = 0; _currentCardSubmits = 0; }
/// <include file='doc\UpWmlMobileTextWriter.uex' path='docs/doc[@for="UpWmlMobileTextWriter.RenderEndHyperlink"]/*' /> public override void RenderEndHyperlink(bool breakAfter) { if (!_inHyperlink) { throw new Exception(); } _inHyperlink = false; if (AnalyzeMode) { CheckRawOutput(); if (CurrentCard.MenuCandidate) { CurrentCard.RenderAsMenu = true; } CurrentCard.HasNonStaticElements = true; if (_inSoftkey) { // Add a softkey if possible. _inSoftkey = false; UpHyperlinkSoftkey softkey = new UpHyperlinkSoftkey(); softkey.TargetUrl = _targetUrl; softkey.EncodeUrl = _encodeUrl; if (_softkeyLabel == null || _softkeyLabel.Length == 0) { _softkeyLabel = _linkText; } softkey.Label = _softkeyLabel; CurrentCard.Softkeys[CurrentCard.SoftkeysUsed++] = softkey; } } else { if (CurrentCard.RenderAsMenu) { Write("<option onpick=\""); if (_targetUrl.StartsWith(Constants.FormIDPrefix, StringComparison.Ordinal)) { // no encoding needed if pointing to another form id Write(_targetUrl); } else if (!_encodeUrl) { Write(EscapeAmpersand(_targetUrl)); } else { WriteEncodedUrl(_targetUrl); } Write("\""); if (_useMenuOptionTitle && IsValidSoftkeyLabel(_softkeyLabel)) { WriteTextEncodedAttribute("title", _softkeyLabel); } Write(">"); WriteEncodedText(_linkText); WriteEndTag("option"); } else if (!CurrentCard.UsesDefaultSubmit) { base.RenderEndHyperlink(breakAfter); } } _currentCardAnchorCount++; if (!AnalyzeMode && _currentCardAnchorCount == CurrentCard.AnchorCount && _currentCardIndex < _cards.Count - 1) { BeginNextCard(); } }