public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteAttributeString("Top", Top.ToString()); writer.WriteAttributeString("Left", Left.ToString()); writer.WriteAttributeString("TabIndex", TabIndex.ToString()); writer.WriteAttributeString("ControlsCount", this.Controls.Count.ToString()); for (int i = 0; i < Controls.Count; ++i) { System.Xml.Serialization.IXmlSerializable x = Controls[i] as System.Xml.Serialization.IXmlSerializable; writer.WriteStartElement(Controls[i].GetType().ToString()); if (x != null) { x.WriteXml(writer); } writer.WriteEndElement(); } }
protected override void AddAttributesToRender(HtmlTextWriter writer) { if (!Compare.IsNullOrEmpty(Name)) { writer.AddAttribute(HtmlTextWriterAttribute.Name, Name); } else if (!Compare.IsNullOrEmpty(ID)) { writer.AddAttribute(HtmlTextWriterAttribute.Name, ID); } if (AccessKey != '\0') { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey.ToString()); } if (TabIndex > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(CultureInfo.InvariantCulture)); } if (Disabled) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } base.AddAttributesToRender(writer); }
public override string ToString() { var tag = new TagBuilder("div"); if (!string.IsNullOrEmpty(Id)) { tag.GenerateId(Id); return(tag.ToString()); } if (string.IsNullOrEmpty(SiteKey)) { throw new InvalidOperationException("SiteKey is required"); } tag.AddCssClass(Constants.RecaptchaClass); tag.MergeAttribute(Constants.SiteKey, SiteKey); tag.MergeAttribute(Constants.Theme, Theme.ToString().ToLower()); tag.MergeAttribute(Constants.Type, Type.ToString().ToLower()); tag.MergeAttribute(Constants.TabIndex, TabIndex.ToString()); if (!string.IsNullOrEmpty(Callback)) { tag.MergeAttribute(Constants.Callback, Callback); } if (!string.IsNullOrEmpty(ExpiredCallback)) { tag.MergeAttribute(Constants.ExpiredCallback, ExpiredCallback); } return(tag.ToString()); }
/// <summary> /// Funckja tworząca w pętli nowych bonusowych przeciwników w zależności od wylosowanej liczby przeciwników /// </summary> private async void AddBonusEnemies() { for (int i = 1; !isLevelEnd;) { await Task.Delay(10 *timeToNewEnemy); i = random.Next(0, 3); if (i == 0) { PictureBox graphics = new PictureBox { BackColor = System.Drawing.Color.Transparent, Cursor = Cursors.Hand, Image = Properties.Resources.DancerBonus, Location = new System.Drawing.Point(random.Next(0, elementHostMedia.Size.Width - 59), random.Next(0, elementHostMedia.Size.Height - 79)), Size = new System.Drawing.Size(59, 79), SizeMode = PictureBoxSizeMode.StretchImage, TabStop = false, TabIndex = 4 * elementsCount, Name = "pictureBoxBonusEnemy" + TabIndex.ToString() + random.Next(elementsCount, Int32.MaxValue).ToString() }; graphics.Click += new EventHandler(EnemyClicked); Controls.Add(graphics); graphics.BringToFront(); graphics.Update(); Enemies.Add(graphics.Name, new Enemy(graphics, new MainDancer(30, 15, 1))); ++elementsCount; } } }
protected override void AddAttributesToRender(HtmlTextWriter writer) { if (!string.IsNullOrEmpty(ExplicitRenderingFunction)) { writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); return; } if (string.IsNullOrEmpty(SiteKey)) { throw new InvalidOperationException("SiteKey is required"); } writer.AddAttribute(HtmlTextWriterAttribute.Class, Constants.RecaptchaClass); writer.AddAttribute(Constants.SiteKey, SiteKey); writer.AddAttribute(Constants.Theme, Theme.ToString().ToLower()); writer.AddAttribute(Constants.Type, Type.ToString().ToLower()); writer.AddAttribute(Constants.TabIndex, TabIndex.ToString()); if (!string.IsNullOrEmpty(Callback)) { writer.AddAttribute(Constants.Callback, Callback); } if (!string.IsNullOrEmpty(ExpiredCallback)) { writer.AddAttribute(Constants.ExpiredCallback, ExpiredCallback); } }
/// <summary> /// Funkcja tworzącego nowego trudnego przeciwnika /// </summary> /// <param name="name">Schemat nazwy przeciwnika</param> public async void CreateHardEnemy(string name = "pictureBoxHardEnemy") { PictureBox graphics = new PictureBox { BackColor = System.Drawing.Color.Transparent, Cursor = Cursors.Hand, Image = Properties.Resources.DancerHard, Location = new System.Drawing.Point(random.Next(0, elementHostMedia.Size.Width - 79), random.Next(0, elementHostMedia.Size.Height - 110)), Size = new System.Drawing.Size(79, 110), SizeMode = PictureBoxSizeMode.StretchImage, TabStop = false, TabIndex = 3 * elementsCount, Name = name + TabIndex.ToString() + random.Next(elementsCount, Int32.MaxValue).ToString() }; graphics.Click += new EventHandler(EnemyClicked); Controls.Add(graphics); graphics.BringToFront(); graphics.Update(); await Task.Run(() => { while (enemiesMove) { ; } }); Enemies.Add(graphics.Name, new Enemy(graphics, new MainDancer(10, 5, 3))); }
void RenderInput(HtmlTextWriter w, bool enabled) { if (ClientID != null && ClientID.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); } w.AddAttribute(HtmlTextWriterAttribute.Type, render_type); string nameAttr = NameAttribute; if (nameAttr != null && nameAttr.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Name, nameAttr); } InternalAddAttributesToRender(w, enabled); AddAttributesToRender(w); if (Checked) { w.AddAttribute(HtmlTextWriterAttribute.Checked, "checked", false); } if (AutoPostBack) { Page page = Page; string onclick = page != null?page.ClientScript.GetPostBackEventReference(GetPostBackOptions(), true) : String.Empty; onclick = String.Concat("setTimeout('", onclick.Replace("\\", "\\\\").Replace("'", "\\'"), "', 0)"); if (common_attrs != null && common_attrs ["onclick"] != null) { onclick = ClientScriptManager.EnsureEndsWithSemicolon(common_attrs ["onclick"]) + onclick; common_attrs.Remove("onclick"); } w.AddAttribute(HtmlTextWriterAttribute.Onclick, onclick); } if (AccessKey.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { w.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } if (common_attrs != null) { common_attrs.AddAttributes(w); } if (inputAttributes != null) { inputAttributes.AddAttributes(w); } w.RenderBeginTag(HtmlTextWriterTag.Input); w.RenderEndTag(); }
protected override void CreateChildControls() { base.CreateChildControls(); Panel pnlContainer = new Panel(); pnlContainer.CssClass = CssClass; System.Web.UI.WebControls.Image cImage = new System.Web.UI.WebControls.Image(); //string imageid = string.Format("CaptchaImage.ashx?guid={0}&s=1", _captcha.UniqueId); //string currentPath = PortalContext.Current.RequestedUri.AbsoluteUri; //string imageid = string.Format("{0}?Action=GetCaptcha&guid={1}&s=1", currentPath, _captcha.UniqueId); cImage.ImageUrl = ActionFramework.GetActionUrl("/Root", "GetCaptcha", string.Empty) + string.Format("&guid={0}&s=1", _captcha.UniqueId); cImage.BorderStyle = BorderStyle.None; cImage.AlternateText = ToolTip; cImage.Width = _captcha.Width; cImage.Height = _captcha.Height; pnlContainer.Controls.Add(cImage); if (this.LayoutStyle == Layout.Vertical) { Literal lBr = new Literal(); lBr.Text = "<br />"; pnlContainer.Controls.Add(lBr); } else { Literal lSpace = new Literal(); lSpace.Text = " "; pnlContainer.Controls.Add(lSpace); } Label lblInstruct = new Label(); lblInstruct.ID = "lblInstructoin"; lblInstruct.Text = Text; lblInstruct.AccessKey = AccessKey; pnlContainer.Controls.Add(lblInstruct); tbUserEntry = new TextBox(); tbUserEntry.ID = "tbUserEntry"; tbUserEntry.AccessKey = AccessKey; tbUserEntry.Attributes.Add("size", _captcha.TextLength.ToString()); tbUserEntry.Attributes.Add("maxlength", _captcha.TextLength.ToString()); if (!Enabled) { tbUserEntry.Attributes.Add("disabled", "disabled"); } if (TabIndex > 0) { tbUserEntry.Attributes.Add("tabindex", TabIndex.ToString()); } pnlContainer.Controls.Add(tbUserEntry); // Set the style:: pnlContainer.Attributes.Add("style", this.CssStyle()); this.Controls.Add(pnlContainer); }
/// <Summary>Render the control</Summary> /// <Param name="writer">An Html Text Writer</Param> protected override void Render(HtmlTextWriter writer) { ControlStyle.AddAttributesToRender(writer); //Render outer <div> Tag //writer.RenderBeginTag(HtmlTextWriterTag.Div); //Render text box <input> Tag writer.AddAttribute(HtmlTextWriterAttribute.Type, "text"); writer.AddAttribute(HtmlTextWriterAttribute.Style, "width:" + Width); writer.AddAttribute(HtmlTextWriterAttribute.Maxlength, _CaptchaText.Length.ToString()); writer.AddAttribute(HtmlTextWriterAttribute.Name, this.UniqueID); if (!String.IsNullOrEmpty(AccessKey)) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (!Enabled) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } if (TabIndex > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString()); } writer.AddAttribute(HtmlTextWriterAttribute.Value, ""); writer.RenderBeginTag(HtmlTextWriterTag.Input); writer.RenderEndTag(); ////Render image <img> Tag writer.AddAttribute(HtmlTextWriterAttribute.Src, GetUrl()); writer.AddAttribute(HtmlTextWriterAttribute.Style, "margin-left:5px;border: solid 1px #8A8A8A;"); if (!String.IsNullOrEmpty(ToolTip)) { writer.AddAttribute(HtmlTextWriterAttribute.Alt, ToolTip); } writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); //Render Help Text //if (!String.IsNullOrEmpty(Text)) //{ // writer.RenderBeginTag(HtmlTextWriterTag.Div); // writer.Write(Text); // writer.RenderEndTag(); //} //Render error message //if (!IsValid && Page.IsPostBack) //{ // ErrorStyle.AddAttributesToRender(writer); // writer.RenderBeginTag(HtmlTextWriterTag.Div); // writer.Write(ErrorMessage); // writer.RenderEndTag(); //} //Render </div> //writer.RenderEndTag(); }
void RenderInput(HtmlTextWriter w, bool enabled) { if (ClientID != null && ClientID.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); } w.AddAttribute(HtmlTextWriterAttribute.Type, render_type); string nameAttr = NameAttribute; if (nameAttr != null && nameAttr.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Name, nameAttr); } InternalAddAttributesToRender(w, enabled); #if NET_2_0 AddAttributesToRender(w); if (inputAttributes != null) { inputAttributes.AddAttributes(w); } #endif if (Checked) { w.AddAttribute(HtmlTextWriterAttribute.Checked, "checked", false); } if (AutoPostBack) { #if NET_2_0 string onclick = Page.ClientScript.GetPostBackEventReference(GetPostBackOptions(), true); onclick = String.Concat("setTimeout('", onclick.Replace("\\", "\\\\").Replace("'", "\\'"), "', 0)"); w.AddAttribute(HtmlTextWriterAttribute.Onclick, BuildScriptAttribute("onclick", onclick)); #else w.AddAttribute(HtmlTextWriterAttribute.Onclick, BuildScriptAttribute("onclick", Page.ClientScript.GetPostBackEventReference(this, String.Empty))); w.AddAttribute("language", "javascript", false); #endif } if (AccessKey.Length > 0) { w.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { w.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } if (common_attrs != null) { common_attrs.AddAttributes(w); } w.RenderBeginTag(HtmlTextWriterTag.Input); w.RenderEndTag(); }
/// <inheritdoc /> protected override void BuildRenderTree(RenderTreeBuilder builder) { builder.OpenElement(0, "input"); builder.AddMultipleAttributes(1, AdditionalAttributes); builder.AddAttribute(2, "class", CssClass); builder.AddAttribute(3, "value", BindConverter.FormatValue(CurrentValue)); builder.AddAttribute(4, "onchange", EventCallback.Factory.CreateBinder<string>(this, __value => CurrentValueAsString = __value, CurrentValueAsString)); builder.AddAttribute(5, "tabindex", TabIndex.ToString()); builder.CloseElement(); }
public string GenerateHTML() { return (String.Format( "<textarea id=\"{0}\" name=\"{1}\"{2}>{4}</textarea>\n<script type=\"text/javascript\">var e = CKEDITOR.instances.{0};if(e != null)CKEDITOR.remove(e);CKEDITOR.replace('{0}'{3});</script>", ClientID, UniqueID, TabIndex != 0 ? " tabindex=\"" + TabIndex.ToString() + "\"" : "", buildConfigOptions(), Text)); }
private void RenderInputTag(HtmlTextWriter htw) { htw.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); htw.AddAttribute(HtmlTextWriterAttribute.Type, "radio"); htw.AddAttribute(HtmlTextWriterAttribute.Name, GroupName); htw.AddAttribute(HtmlTextWriterAttribute.Value, Value); if (Checked) { htw.AddAttribute(HtmlTextWriterAttribute.Checked, "checked"); } if (!Enabled) { htw.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } string onClick = Attributes["onclick"]; if (AutoPostBack) { if (onClick != null) { onClick = String.Empty; } onClick += Page.ClientScript.GetPostBackEventReference(this, String.Empty); htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick); htw.AddAttribute("language", "javascript"); } else { if (onClick != null) { htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick); } } if (AccessKey.Length > 0) { htw.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { htw.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } htw.RenderBeginTag(HtmlTextWriterTag.Input); htw.RenderEndTag(); // add text to the render if (!String.IsNullOrEmpty(Text)) { RenderLabel(htw, Text, ClientID); } }
/// <summary> /// Add attributes to the tag. /// </summary> /// <param name="writer">The current HtmlTextWriter object.</param> protected override void AddAttributesToRender(HtmlTextWriter writer) { if (this.TabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } if (this.ReadOnly == false) { writer.AddAttribute("onFocus", string.Format("return AIP_numeralsBefore(this, '{0}');", this.CurrencySymbol)); writer.AddAttribute("onBlur", string.Format("return AIP_numeralsAfter(this,'{4}',{0},{1},{2},'{3}');", this.MinValue.ToString(), this.MaxValue.ToString(), this.Precision.ToString(), this.Delimiter, this.CurrencySymbol)); writer.AddAttribute("onKeyPress", string.Format("return AIP_numeralsOnly(event,this,{0},{1},{2},'{3}');", this.MinValue.ToString(), this.MaxValue.ToString(), this.Precision.ToString(), this.Delimiter)); } }
/// <summary> /// Adds attributes for the anchor tag. /// </summary> /// <param name="writer">The HtmlTextWriter object that receives the content.</param> private void AddAnchorAttributes(HtmlTextWriter writer) { CssCollection currentStyle = CurrentStyle; writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + AnchorHref); if (AccessKey != String.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString()); } writer.AddAttribute("onclick", "return confirm('Are you sure?');"); string style = String.Empty; // Custom underline string textDec = currentStyle["text-decoration"]; if (textDec != null) { style += "text-decoration:" + textDec + ";"; } // Custom cursor string cursor = currentStyle["cursor"]; if (cursor != null) { style += "cursor:" + cursor + ";"; } // Re-apply custom styles if (style != String.Empty) { writer.AddAttribute("style", style); } // Re-apply the current color; string currentColor = currentStyle["color"]; if ((currentColor != null) && (currentColor != String.Empty)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Color, currentColor); } }
private void RenderInputTag(HtmlTextWriter htw) { htw.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); htw.AddAttribute(HtmlTextWriterAttribute.Type, "radio"); htw.AddAttribute(HtmlTextWriterAttribute.Name, GroupName); htw.AddAttribute(HtmlTextWriterAttribute.Value, Value); if (Checked) { htw.AddAttribute(HtmlTextWriterAttribute.Checked, "checked"); } if (!Enabled) { htw.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } string onClick = Attributes["onclick"]; if (AutoPostBack) { if (onClick != null) { onClick = String.Empty; } //GREG:: the following has been depreciated please amend the code. //onClick += Page.GetPostBackClientEvent(this, String.Empty); htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick); htw.AddAttribute("language", "javascript"); } else { if (onClick != null) { htw.AddAttribute(HtmlTextWriterAttribute.Onclick, onClick); } } if (AccessKey.Length > 0) { htw.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { htw.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } htw.RenderBeginTag(HtmlTextWriterTag.Input); htw.RenderEndTag(); }
protected virtual void AddAttributesToRender(HtmlTextWriter writer) { #if NET_4_0 RenderDisabled(writer); #endif if (ID != null) { writer.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); } #if !NET_4_0 RenderDisabled(writer); #endif if (AccessKey != string.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (ToolTip != string.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip); } if (TabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString()); } if (style != null && !style.IsEmpty) { #if NET_2_0 //unbelievable, but see WebControlTest.RenderBeginTag_BorderWidth_xxx if (TagKey == HtmlTextWriterTag.Span) { AddDisplayStyleAttribute(writer); } #endif style.AddAttributesToRender(writer, this); } if (attributes != null) { foreach (string s in attributes.Keys) { writer.AddAttribute(s, attributes [s]); } } }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteAttributeString("Top", Top.ToString()); writer.WriteAttributeString("Left", Left.ToString()); writer.WriteAttributeString("TabIndex", TabIndex.ToString()); //***// writer.WriteAttributeString("ForeColor", ForeColor.Name); writer.WriteAttributeString("TextAlign", ((int)TextAlign).ToString()); writer.WriteAttributeString("FontName", Font.Name); writer.WriteAttributeString("FontSize", Font.SizeInPoints.ToString()); writer.WriteAttributeString("FontStyle", ((int)Font.Style).ToString()); //***// writer.WriteAttributeString("Name", Name); //***// writer.WriteElementString("Text", Text); }
private void VerifyCommonLogic() { _editorForm.ShouldSatisfyAllConditions( () => _tbTabIndex.Text.ShouldBe(TabIndex.ToString()), () => _tbMaxLength.Text.ShouldBe(MaxLength.ToString()), () => _tbDesignIcon.Text.ShouldBe(DesignIcon), () => _tbDesignLabel.Text.ShouldBe(DesignLabel), () => _tbHtmlIcon.Text.ShouldBe(HtmlIcon), () => _tbHtmlLabel.Text.ShouldBe(HtmlLabel), () => _tbPreviewIcon.Text.ShouldBe(PreviewIcon), () => _tbPreviewLabel.Text.ShouldBe(PreviewLabel), () => _tbRows.Text.ShouldBe(TextAreaRows), () => _tbCols.Text.ShouldBe(TextAreaColumns), () => _tbCssClass.Text.ShouldBe(CssClass)); VerifyCheckBoxList(); VerifyStyles(); }
/// <summary> /// Setup a tab according to the specified parameters. /// </summary> private void SetupTab(TabPage TabPage, string TabText, Image TabImage, UserControl Contents) { // If the tab text passed in is a filename then only show the filename (no path) // on the tab. The ToolTipText will still have the f ull path and name. if (TabText.Contains(Path.DirectorySeparatorChar.ToString())) { TabPage.Text = Path.GetFileNameWithoutExtension(TabText); } else { TabPage.Text = TabText; } TabPage.Name = TabText; TabPage.ToolTipText = TabText; // Add the specified tab image to the image list if it doesn't already exist. if (TabImage != null) { int TabIndex; for (TabIndex = 0; TabIndex < TabImageList.Images.Count; TabIndex++) { if (TabIndex.Equals(TabImage)) { break; } } if (TabIndex == TabImageList.Images.Count) { TabImageList.Images.Add(TabImage); } TabPage.ImageIndex = TabIndex; } else { TabPage.ImageIndex = -1; } // Add the TabForm passed in to the new tab page. TabPage.Controls.Clear(); TabPage.Controls.Add(Contents); Contents.Dock = DockStyle.Fill; }
void RenderInputTag(HtmlTextWriter htw) { htw.AddAttribute(HtmlTextWriterAttribute.Id, ClientID); htw.AddAttribute(HtmlTextWriterAttribute.Type, "radio"); htw.AddAttribute(HtmlTextWriterAttribute.Name, GroupName); htw.AddAttribute(HtmlTextWriterAttribute.Value, Value); if (Checked) { htw.AddAttribute(HtmlTextWriterAttribute.Checked, "checked"); } if (!Enabled) { htw.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } string str = base.Attributes["onclick"]; if (AutoPostBack) { if (str != null) { str = string.Empty; } str = str + Page.ClientScript.GetPostBackEventReference(this, string.Empty); htw.AddAttribute(HtmlTextWriterAttribute.Onclick, str); htw.AddAttribute("language", "javascript"); } else if (str != null) { htw.AddAttribute(HtmlTextWriterAttribute.Onclick, str); } if (AccessKey.Length > 0) { htw.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { htw.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(NumberFormatInfo.InvariantInfo)); } htw.RenderBeginTag(HtmlTextWriterTag.Input); htw.RenderEndTag(); }
/// <summary> /// Opens the anchor tag. /// </summary> /// <param name="writer">The HtmlTextWriter object that receives the content.</param> private void RenderBeginAnchor(HtmlTextWriter writer) { if (RenderAnchor) { // If not selected, then render an anchor writer.AddAttribute(HtmlTextWriterAttribute.Href, "javascript:" + AnchorHref); if (AccessKey != String.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey); } if (TabIndex != 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString()); } string style = String.Empty; // Custom underline if (CurrentStyle["text-decoration"] != null) { style += "text-decoration:" + CurrentStyle["text-decoration"] + ";"; } // Custom cursor if (CurrentStyle["cursor"] != null) { style += "cursor:" + CurrentStyle["cursor"] + ";"; } // Re-apply the current color; string currentColor = CurrentStyle["color"]; if ((currentColor != null) && (currentColor != String.Empty)) { writer.AddStyleAttribute(HtmlTextWriterStyle.Color, currentColor); } writer.RenderBeginTag(HtmlTextWriterTag.A); } }
public void RenderContolBody(HtmlTextWriter output) { var currentAsm = Assembly.GetExecutingAssembly(); var pagingBarContent = currentAsm.GetManifestResourceStream("Kesco.Lib.Web.Controls.V4.PagingBar.PagingBarContent.htm"); if (pagingBarContent == null) { return; } var reader = new StreamReader(pagingBarContent); var sourceContent = reader.ReadToEnd(); sourceContent = sourceContent.Replace(IDTag, ID); sourceContent = sourceContent.Replace(LCurrentPageTag, _resx.GetString("PageBar_lCurrentPage")); sourceContent = sourceContent.Replace(ListenerTag, ListenerPos.ToString(CultureInfo.InvariantCulture)); sourceContent = sourceContent.Replace(LTotalRows, _resx.GetString("PageBar_lOf")); sourceContent = sourceContent.Replace(LRowsPerPage, _resx.GetString("PageBar_lRowsPerPage")); sourceContent = sourceContent.Replace(LFirstPage, _resx.GetString("PageBar_lFirstPage")); sourceContent = sourceContent.Replace(LPrevPage, _resx.GetString("PageBar_lPrevPage")); sourceContent = sourceContent.Replace(LNextPage, _resx.GetString("PageBar_lNextPage")); sourceContent = sourceContent.Replace(LLastPage, _resx.GetString("PageBar_lLastPage")); sourceContent = sourceContent.Replace(LTabIndex, TabIndex.ToString(CultureInfo.InvariantCulture)); using (TextWriter currentPageTextWriter = new StringWriter()) { var currentPageWriter = new HtmlTextWriter(currentPageTextWriter); _currentPageCtrl.RenderControl(currentPageWriter); sourceContent = sourceContent.Replace(CtrlCurNumbTag, currentPageTextWriter.ToString()); } using (TextWriter rowsCountTextWriter = new StringWriter()) { var rowsCountWriter = new HtmlTextWriter(rowsCountTextWriter); _rowsPerPageCtrl.RenderControl(rowsCountWriter); sourceContent = sourceContent.Replace(CtrlRowPerPageTag, rowsCountTextWriter.ToString()); } sourceContent = sourceContent.Replace("\n", "").Replace("\r", "").Replace("\t", ""); output.Write(sourceContent); }
public override int GetHashCode() { unchecked { var hashCode = PropMask?.GetHashCode() ?? 0; hashCode = (hashCode * 397) ^ (Name?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (Tag?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ Id; hashCode = (hashCode * 397) ^ HelpContextId; hashCode = (hashCode * 397) ^ (int)BitFlags; hashCode = (hashCode * 397) ^ (int)ObjectStreamSize; hashCode = (hashCode * 397) ^ TabIndex.GetHashCode(); hashCode = (hashCode * 397) ^ ClsidCacheIndex.GetHashCode(); hashCode = (hashCode * 397) ^ GroupId.GetHashCode(); hashCode = (hashCode * 397) ^ (ControlTipText?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RuntimeLicKey?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (ControlSource?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (RowSource?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (SitePosition?.GetHashCode() ?? 0); return(hashCode); } }
void RenderControl(RenderContext context, Action <TagBuilder> onRender, MergeAttrMode mode) { var tag = new TagBuilder("label", ControlType, IsInGrid); onRender?.Invoke(tag); MergeAttributes(tag, context, mode); if (IsLabelEmpty) { tag.AddCssClass("no-label"); } if (Color != TextColor.Default) { tag.AddCssClass("text-color-" + Color.ToString().ToKebabCase()); } tag.RenderStart(context); var input = new TagBuilder("input"); input.MergeAttribute("type", InputControlType); if (TabIndex != 0) { input.MergeAttribute("tabindex", TabIndex.ToString()); } input.MergeAttribute("v-settabindex", String.Empty); MergeCheckBoxValue(input, context); MergeCheckBoxAttributes(input, context); input.Render(context, TagRenderMode.SelfClosing); var span = new TagBuilder("span"); var lblBind = GetBinding(nameof(Label)); if (lblBind != null) { span.MergeAttribute("v-text", lblBind.GetPathFormat(context)); } else if (Label != null) { span.SetInnerText(Label.ToString()); } span.Render(context); // always (empty too) tag.RenderEnd(context); }
protected override void RenderContents(HtmlTextWriter output) { output.AddAttribute("type", "text/javascript"); output.AddAttribute("src", "http://api.recaptcha.net/js/recaptcha_ajax.js"); output.AddAttribute("defer", "defer"); output.RenderBeginTag("script"); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Id, "spnCaptchaIncorrect"); output.AddAttribute(HtmlTextWriterAttribute.Style, "color:Red;display:none;"); output.RenderBeginTag("span"); output.WriteLine("The captcha text was not valid. Please try again."); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Id, "recaptcha_placeholder"); output.RenderBeginTag(HtmlTextWriterTag.Div); output.RenderEndTag(); output.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript"); output.RenderBeginTag(HtmlTextWriterTag.Script); output.WriteLine("function showRecaptcha() {"); output.WriteLine("Recaptcha.create('" + publicKey + "', 'recaptcha_placeholder', {"); output.WriteLine("theme: '{0}',", Theme); output.WriteLine("tabindex: {0}", TabIndex.ToString()); output.WriteLine("})"); output.WriteLine("}"); output.WriteLine("var rc_oldonload = window.onload;"); output.WriteLine("if (typeof window.onload != 'function') {"); output.WriteLine("window.onload = showRecaptcha;"); output.WriteLine("}"); output.WriteLine("else {"); output.WriteLine("window.onload = function() {"); output.WriteLine("rc_oldonload();"); output.WriteLine("showRecaptcha();"); output.WriteLine("}"); output.WriteLine("}"); output.RenderEndTag(); }
public void WriteXml(System.Xml.XmlWriter writer) { /**writer.WriteAttributeString("Width",Width.ToString()); * writer.WriteAttributeString("Height",Height.ToString()); * writer.WriteAttributeString("Top",Top.ToString()); * writer.WriteAttributeString("Left",Left.ToString()); * writer.WriteAttributeString("TabIndex",TabIndex.ToString()); * writer.WriteElementString("Text",Text); * /*writer.WriteAttributeString("ControlsCount",this.Controls.Count.ToString()); * for(int i = 0; i<Controls.Count; ++i) * { * System.Xml.Serialization.IXmlSerializable x = * Controls[i] as System.Xml.Serialization.IXmlSerializable; * writer.WriteStartElement(Controls[i].GetType().ToString()); * if(x!=null) * { * x.WriteXml(writer); * } * writer.WriteEndElement(); * }*/ writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteAttributeString("Top", Top.ToString()); writer.WriteAttributeString("Left", Left.ToString()); writer.WriteAttributeString("TabIndex", TabIndex.ToString()); //***// writer.WriteAttributeString("ForeColor", ForeColor.Name); writer.WriteAttributeString("FontName", Font.Name); writer.WriteAttributeString("FontSize", Font.SizeInPoints.ToString()); writer.WriteAttributeString("FontStyle", ((int)Font.Style).ToString()); //***// writer.WriteAttributeString("Name", Name); //***// writer.WriteAttributeString("ItemsCount", this.Words.Length.ToString()); for (int i = 0; i < Words.Length; ++i) { writer.WriteElementString("Item" + i.ToString(), Words[i]); } writer.WriteElementString("Text", Text); }
internal override void RenderElement(RenderContext context, Action <TagBuilder> onRender = null) { if (CheckDisabledModel(context)) { return; } var tag = new TagBuilder("label", ControlType, IsInGrid); onRender?.Invoke(tag); MergeAttributes(tag, context, MergeAttrMode.NoTabIndex); if (IsLabelEmpty) { tag.AddCssClass("no-label"); } tag.RenderStart(context); var input = new TagBuilder("input"); input.MergeAttribute("type", InputControlType); if (TabIndex != 0) { input.MergeAttribute("tabindex", TabIndex.ToString()); } input.MergeAttribute("v-settabindex", String.Empty); MergeCheckBoxValue(input, context); MergeCheckBoxAttributes(input, context); input.Render(context, TagRenderMode.SelfClosing); var span = new TagBuilder("span"); var lblBind = GetBinding(nameof(Label)); if (lblBind != null) { span.MergeAttribute("v-text", lblBind.GetPathFormat(context)); } else if (Label != null) { span.SetInnerText(Label.ToString()); } span.Render(context); // always (empty too) tag.RenderEnd(context); }
public void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Width", Width.ToString()); writer.WriteAttributeString("Height", Height.ToString()); writer.WriteAttributeString("Top", Top.ToString()); writer.WriteAttributeString("Left", Left.ToString()); writer.WriteAttributeString("TabIndex", TabIndex.ToString()); //***// writer.WriteAttributeString("ForeColor", ForeColor.Name); writer.WriteAttributeString("FontName", Font.Name); writer.WriteAttributeString("FontSize", Font.SizeInPoints.ToString()); writer.WriteAttributeString("FontStyle", ((int)Font.Style).ToString()); //***// writer.WriteAttributeString("Name", Name); //***// writer.WriteAttributeString("ItemsCount", this.Items.Count.ToString()); for (int i = 0; i < Items.Count; ++i) { writer.WriteElementString("Item" + i.ToString(), Items[i].ToString()); } writer.WriteElementString("Text", Text); }
protected override void AddAttributesToRender(HtmlTextWriter writer) { base.AddAttributesToRender(writer); writer.AddAttribute(HtmlTextWriterAttribute.Type, InputType); if (!Compare.IsNullOrEmpty(Name)) { writer.AddAttribute(HtmlTextWriterAttribute.Name, Name); } else if (!Compare.IsNullOrEmpty(ID)) { writer.AddAttribute(HtmlTextWriterAttribute.Name, ID); } string value = GetValue(); if (!Compare.IsNullOrEmpty(value)) { writer.AddAttribute(HtmlTextWriterAttribute.Value, value); } if (AccessKey != '\0') { writer.AddAttribute(HtmlTextWriterAttribute.Accesskey, AccessKey.ToString()); } if (TabIndex > 0) { writer.AddAttribute(HtmlTextWriterAttribute.Tabindex, TabIndex.ToString(CultureInfo.InvariantCulture)); } if (Disabled) { writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "disabled"); } if (!Compare.IsNullOrEmpty(Tooltip)) { writer.AddAttribute(HtmlTextWriterAttribute.Title, Tooltip); } }
private bool IsTabAvailable(TabIndex currentTab) { TabIndex lastCompletedStep = GetAppraiserUserLastCompletedStep(); bool hasValidLicenses = true; if (currentTab > TabIndex.License) hasValidLicenses = IsLicenseTabFilled(); return (currentTab <= lastCompletedStep) && hasValidLicenses; }
private ActionResult RedirectToStep(TabIndex step, bool? bankingInfoSaved = null) { switch (step) { case TabIndex.Contact: return RedirectToAction(NameHelper.AppraiserWizard.Contact); case TabIndex.License: return RedirectToAction(NameHelper.AppraiserWizard.License); case TabIndex.Affiliation: return RedirectToAction(NameHelper.AppraiserWizard.Affiliations); case TabIndex.Software: return RedirectToAction(NameHelper.AppraiserWizard.Software); case TabIndex.Fees: return RedirectToAction(NameHelper.AppraiserWizard.Fees); case TabIndex.ServiceArea: return RedirectToAction(NameHelper.AppraiserWizard.ServiceArea); case TabIndex.Banking: return RedirectToAction(NameHelper.AppraiserWizard.Banking, new { bankingInfoSaved = bankingInfoSaved }); default: throw new IndexOutOfRangeException("Unknow step: " + step.ToString()); } }
private void SaveLastCompletedStep(TabIndex currentStep, int? nextStep) { string email = User.Identity.Name; if (!nextStep.HasValue) { _appraiserUserService.SetAppraiserSignUpLastStep(email, (int)currentStep); } else if (nextStep.Value > (int)currentStep) { _appraiserUserService.SetAppraiserSignUpLastStep(email, (int)currentStep + 1); } else if (nextStep.Value < (int)currentStep) { _appraiserUserService.SetAppraiserSignUpLastStep(email, (int)currentStep - 1); } }
private bool IsTabAvailable(TabIndex currentTab) { int lastCompletedStep = GetAppraisalCompanyLastCompletedStep(); return (int)currentTab <= lastCompletedStep; }