public static Button GetButton(ResourceCache cache, ButtonType btype, string tooltip = "") { var button = new Button(); button.Name = btype.ToString(); button.SetStyleAuto(); button.SetToolTip(string.IsNullOrEmpty(tooltip) ? btype.ToString() : tooltip); switch (btype) { case ButtonType.Save: { button.Texture = cache.GetTexture2D("Buttons/Save.png"); button.BlendMode = BlendMode.Add; } break; case ButtonType.Close: { button.SetStyle("CloseButton"); } break; default: break; } return(button); }
/// <summary> /// 建立一个submit类型的按钮 /// </summary> /// <param name="htmlHelper"></param> /// <param name="buttonText"></param> /// <param name="userOperatorRole"></param> /// <returns></returns> public static MvcHtmlString CreateButton(this HtmlHelper htmlHelper, string id, string buttonText, ButtonType buttonType, Enum operatorAuthority) { if ((Convert.ToInt32((System.Web.HttpContext.Current.Session["OperatorAuthority"] ?? "0").ToString()) & Convert.ToInt32(operatorAuthority)) == 0) { return(new MvcHtmlString("<input id='" + id + "' type='" + buttonType.ToString() + "' value='" + buttonText + "' disabled='disabled'/>")); } else { return(new MvcHtmlString("<input id='" + id + "' type='" + buttonType.ToString() + "' value='" + buttonText + "' />")); } }
public override void WriteXml(XmlWriter writer) { TypeConverter colorConverter = TypeDescriptor.GetConverter(typeof(Color)); base.WriteXml(writer); writer.WriteElementString("Type", ButtonType.ToString()); writer.WriteElementString("Image", Image); writer.WriteElementString("PushedImage", PushedImage); if (Glyph != PushButtonGlyph.None) { writer.WriteStartElement("Glyph"); writer.WriteElementString("Type", Glyph.ToString()); writer.WriteElementString("Color", colorConverter.ConvertToInvariantString(GlyphColor)); writer.WriteElementString("Thickness", GlyphThickness.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Scale", GlyphScale.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); } if (Text != null && Text.Length > 0) { writer.WriteStartElement("Text"); writer.WriteElementString("Color", colorConverter.ConvertToInvariantString(TextColor)); writer.WriteStartElement("Font"); TextFormat.WriteXml(writer); writer.WriteEndElement(); writer.WriteElementString("Text", Text); writer.WriteEndElement(); } }
public override string ToString() { ParseButtonData(); StringBuilder sb = new StringBuilder(); sb.AppendFormat("{0} (Id = {1})\n", this.GetType().Name, ID); sb.AppendLine(" Type: " + m_eType.ToString()); sb.AppendLine(" Flags: 0x" + m_wFlags.ToString("x4")); sb.Append(" Jumps:"); if (m_dwJumpVals == null) { sb.AppendLine(" <none>"); } else { foreach (uint jval in m_dwJumpVals) { sb.Append(" " + jval); } sb.AppendLine(); } return(sb.ToString()); }
public override string GetStringAttributes() { if (this is bsButtonInput) { switch ((this as bsButtonInput).InputType) { case bmButtonInputTypesEnum.reset: ButtonType = hmButtonTypesEnum.reset; break; case bmButtonInputTypesEnum.submit: ButtonType = hmButtonTypesEnum.submit; break; default: ButtonType = hmButtonTypesEnum.button; break; } SetAttribute("type", ButtonType.ToString()); } if (IsActive) { SetAttribute("aria-pressed", "true"); } if (ToggleActiveState) { SetAttribute("data-toggle", "button"); SetAttribute("autocomplete", "off"); SetAttribute("aria-pressed", "true"); } return(base.GetStringAttributes()); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); var textBlock = GetTemplateChild(TextBlockName) as TextBlock; if (textBlock != null) { var binding = new Binding(nameof(DisplayName)); binding.Source = this; binding.Mode = BindingMode.OneWay; textBlock.SetBinding(TextBlock.TextProperty, binding); if (string.IsNullOrWhiteSpace(DisplayName)) { DisplayName = ButtonType.ToString(); } } var image = GetTemplateChild(ImageName) as Image; if (image != null) { //var resources = new ResourceDictionary { Source = new Uri("/EfficientDesigner_Control;component/Themes/Icon.xaml", UriKind.Absolute) }; image.Source = GetSource(ButtonType); } }
public override void Process(TagHelperContext context, TagHelperOutput output) { output.TagName = "button"; output.Attributes.SetAttribute("id", string.IsNullOrEmpty(ButtonId) ? "" : ButtonId); output.AddClass("govuk-button", HtmlEncoder.Default); if (StartNow) { output.AddClass("govuk-button--start", HtmlEncoder.Default); } if (Secondary) { output.AddClass("govuk-button--secondary", HtmlEncoder.Default); } output.Attributes.SetAttribute("type", ButtonType.ToString().ToLower()); if (ButtonStatus == GdsEnums.Status.Disabled) { output.Attributes.SetAttribute("disabled", "disabled"); output.Attributes.SetAttribute("aria-disabled", "true"); output.Attributes.SetAttribute("class", "govuk-button govuk-button--disabled"); } output.Content.SetContent(ButtonText); }
// ButtonType.Button, "Primary", Btn.Primary public static MvcHtmlString BootstrapButton(this HtmlHelper helper, ButtonType buttonType, string title, string btnClass) { var btn = new TagBuilder("button"); btn.AddCssClass(btnClass); btn.Attributes.Add("type", buttonType.ToString().ToLower()); btn.SetInnerText(title); return(new MvcHtmlString(btn.ToString(TagRenderMode.Normal))); }
public override string GetStringAttributes() { if (ButtonType != hmButtonTypesEnum.NULL) { SetAttribute("type", ButtonType.ToString()); } return(base.GetStringAttributes()); }
public override void Serialize(XmlWriter writer) { base.Serialize(writer); writer.WriteAttributeString("normalId", normalID.ToString()); writer.WriteAttributeString("pressedId", pressedID.ToString()); writer.WriteAttributeString("buttonType", buttonType.ToString()); writer.WriteAttributeString("buttonState", buttonState.ToString()); writer.WriteAttributeString("value", value.ToString()); }
private void InitButton(Button button, ButtonType type) { button.Width = BUTTON_WIDTH; button.Text = type.ToString().ToLower().Replace("_", " "); button.Click += (sender, ev) => { buttons.ForEach(b => b.Enabled = false); imageLoader.RunWorkerAsync(type); }; }
public static MvcHtmlString ButtonWithTagBuilder(this HtmlHelper helper, ButtonType type, string id = "buttonId", string text = "save") { TagBuilder builder = new TagBuilder("button"); builder.GenerateId(id); builder.SetInnerText(text); builder.Attributes.Add(new KeyValuePair <string, string>("type", type.ToString())); return(MvcHtmlString.Create(builder.ToString())); }
public void SendButton(ButtonType bt) { var text = bt.ToString(); if (text[0] == '_') { text = text.Substring(1); } _connection.SendMessageAsync($"type:button\nname:{text}\n\n").ConfigureAwait(false); }
/// <summary> /// 设置按钮使能性 /// <param name="type">按钮名称</param> /// <param name="isEnable">是否使能</param> //-------------------------------------------------------------------------- //修改历史: //日期 修改人 修改 //2010-8-3 zhanggang 创建代码 //-------------------------------------------------------------------------- public void SetButtonEnable(ButtonType type, bool isEnable) { logger.Debug("设置按钮使能性处理开始。"); Button btn = FindName(type.ToString()) as Button; btn.IsEnabled = isEnable; logger.Debug("设置按钮使能性处理结束。"); }
public static MvcHtmlString Button(this HtmlHelper helper, string id = "defaultid", string cssClass = "", ButtonType typ = ButtonType.button, string text = "defaultext") { TagBuilder tag = new TagBuilder("button"); tag.AddCssClass(cssClass); tag.GenerateId(id); tag.SetInnerText(text); tag.Attributes.Add(new KeyValuePair <string, string>("type", typ.ToString())); tag.Attributes.Add(new KeyValuePair <string, string>("name", id)); return(MvcHtmlString.Create(tag.ToString())); }
static public MvcHtmlString ButtonBuilder(this HtmlHelper helper, ButtonType type, string id, string labelText) { var btn = new TagBuilder("button"); btn.MergeAttribute("type", type.ToString()); btn.MergeAttribute("id", id); btn.MergeAttribute("class", "btn btn-primary"); return(MvcHtmlString.Create(btn.ToString(TagRenderMode.StartTag) + labelText + btn.ToString(TagRenderMode.EndTag))); }
public static MvcHtmlString Button(this HtmlHelper helper, string id = "", string cssClass = "", ButtonType type = ButtonType.button, string text = "") { //TagBuilder metotlarla daha pratik ve efektif kod yazmamıza imkan sağlar. TagBuilder tag = new TagBuilder("button"); tag.AddCssClass(cssClass); tag.GenerateId(id); tag.Attributes.Add(new KeyValuePair <string, string>("type", type.ToString())); tag.Attributes.Add(new KeyValuePair <string, string>("name", id)); tag.SetInnerText(text); return(MvcHtmlString.Create(tag.ToString())); }
public static MvcHtmlString ButtonWithTagBuilder(this HtmlHelper helper, string id = "", string cssClass = "", ButtonType type = ButtonType.button, string text = "") { TagBuilder tag = new TagBuilder("button"); tag.AddCssClass(cssClass); tag.GenerateId(id); tag.Attributes.Add("type", type.ToString()); tag.Attributes.Add("name", id); tag.SetInnerText(text); return(MvcHtmlString.Create(tag.ToString())); }
public virtual IDictionary <string, object> Serialize(IGridUrlBuilder urlBuilder) { var command = new Dictionary <string, object>(); FluentDictionary.For(command) .Add("name", Name) .Add("attr", HtmlAttributes.ToAttributeString(), () => HtmlAttributes.Any()) .Add("buttonType", ButtonType.ToString()) .Add("imageAttr", ImageHtmlAttributes.ToAttributeString(), () => ImageHtmlAttributes.Any()); return(command); }
public static MvcHtmlString ButtonRenkli(this HtmlHelper helper, string id, ButtonType typ, string text, ButtonRenk rnk, string val = "") { TagBuilder tag = new TagBuilder("button"); tag.AddCssClass("btn btn-" + rnk); tag.GenerateId(id); tag.Attributes.Add(new KeyValuePair <string, string>("type", typ.ToString())); tag.Attributes.Add(new KeyValuePair <string, string>("name", id)); tag.Attributes.Add(new KeyValuePair <string, string>("value", val)); tag.SetInnerText(text); return(MvcHtmlString.Create(tag.ToString())); }
public void Initialize(GameObject _object) { ButtonObject = _object; ButtonTimer = ButtonObject.GetComponent <UITimer>(); //set the button text ButtonText = ButtonToPress.ToString(); ButtonObject.GetComponentInChildren <Text>().text = ButtonText; //set the button time; ButtonTimer.TargetTime = TimeToPress; }
/// <summary> /// 添加class /// </summary> /// <param name="context"></param> /// <param name="output"></param> protected virtual void AddClasses(TagHelperContext context, TagHelperOutput output) { output.Attributes.AddClass("btn"); if (ButtonType != CtrlButtonType.Default) { output.Attributes.AddClass("btn-" + ButtonType.ToString().ToLowerInvariant().Replace("_", "-")); } if (Size != CtrlButtonSize.Default) { output.Attributes.AddClass(Size.ToClassName()); } }
// Geneates a td element containing a button to add and delete table rows private static string ButtonCell(ButtonType type) { TagBuilder button = new TagBuilder("button"); button.AddCssClass("table-button"); button.AddCssClass(string.Format("{0}-button", type.ToString().ToLower())); button.MergeAttribute("type", "button"); TagBuilder cell = new TagBuilder("td"); cell.AddCssClass("button-cell"); cell.InnerHtml = button.ToString(); return(cell.ToString()); }
/// <summary> /// 没有子菜单构造函数 /// </summary> public MenuInfo(string name, ButtonType buttonType, string value) { this.name = name; this.type = buttonType.ToString(); if (buttonType == ButtonType.click) { this.key = value; } else if (buttonType == ButtonType.view) { this.url = value; } }
public virtual IDictionary <string, object> Serialize(IGridUrlBuilder urlBuilder) { var command = new Dictionary <string, object>(); FluentDictionary.For(command) .Add("name", Name) .Add("attr", HtmlAttributes.ToAttributeString(), HtmlAttributes.Any) .Add("buttonType", ButtonType.ToString()) .Add("text", Text, (System.Func <bool>)Text.HasValue); //TODO: Implement command button image html attributes //.Add("imageAttr", ImageHtmlAttributes.ToAttributeString(), ImageHtmlAttributes.Any); return(command); }
/// <summary> /// 参数化构造函数 /// </summary> /// <param name="name">按钮名称</param> /// <param name="buttonType">菜单按钮类型</param> /// <param name="value">按钮的键值(Click),或者连接URL(View)</param> public MenuInfo(string name, ButtonType buttonType, string value) { this.name = name; this.type = buttonType.ToString(); if (buttonType == ButtonType.click) { this.key = value; } else if (buttonType == ButtonType.view) { this.url = value; } }
internal override void AddAttributes() { if (Value.IsNullOrEmpty()) { Value = Label; } Attributes["type"] = ButtonType.ToString().ToLower(); Attributes["value"] = Value; if (!OnClick.IsNullOrEmpty()) { Attributes["onclick"] = OnClick; } base.AddAttributes(); }
void FixedUpdate() { if (GameManager.Instance.GameControls != null && currChar().playerData != null && currChar().CurrentMode == CharacterMode.CONTROLLING) { ButtonType buttPressed = GameManager.Instance.GameControls.GetButtonClick; if (GameManager.Instance.GameControls.OnJoyStickDrag) { vertical = GameManager.Instance.GameControls.GetJoyStickVertical; horizontal = GameManager.Instance.GameControls.GetJoyStickHorizontal; currChar().playerAnimtor.SetFloat(AnimParam.VERTICAL, vertical); currChar().playerAnimtor.SetFloat(AnimParam.HORIZONTAL, horizontal); movement = new Vector3(horizontal * currChar().playerData.SPD, 0, vertical * currChar().playerData.SPD); CharacterRotater(movement); MoveCharacter(movement); movementReset = false; } else if (!GameManager.Instance.GameControls.OnJoyStickDrag && !movementReset) { this.MovementReset(); } //Debug.Log (buttPressed.ToString ()); if (buttPressed != ButtonType.NONE && attackReset && !delayReseting) { ButtonType buttType = GameManager.Instance.GameControls.GetButtonClick; currChar().playerAnimtor.SetBool(AnimParam.PERFORMING_ATTACK, true); currChar().playerAnimtor.SetInteger(AnimParam.ACTION_TRACKER, (int)buttType); attackReset = false; Debug.Log(buttType.ToString()); } else if (buttPressed == ButtonType.NORMAL_ATTACK && allowCombo && attackCombo && !attackReset && !delayReseting) { currChar().playerAnimtor.SetTrigger(AnimParam.COMBO); attackCombo = false; Debug.Log("Trigger"); } else if ((int)buttPressed >= (int)ButtonType.CHARACTER_CHANGE_1 && (int)buttPressed <= (int)ButtonType.CHARACTER_CHANGE_4) { CharacterSwitch((((int)buttPressed) - (int)ButtonType.CHARACTER_CHANGE_1), false); } else if (buttPressed != ButtonType.NONE && !attackReset && !delayReseting) { delayReseting = true; Invoke("AttackReset", 0.5f); } } }
private static Dictionary <string, string> GetButtonOverrideSettings(ButtonType buttonType, string parentID, bool validateForm, string actionName, StylePropertyBag style, short tabIndex, string onClickFunction, string cssClass = "", string imagePath = "") { Dictionary <string, string> overrideSettings; overrideSettings = new Dictionary <string, string>(); overrideSettings.Add(ControlLibConstants.BUTTON_TYPE, buttonType.ToString()); overrideSettings.Add(ControlLibConstants.PARENT_ID, parentID); overrideSettings.Add(ControlLibConstants.TAB_INDEX, tabIndex.ToString()); overrideSettings.Add(ControlLibConstants.ON_CLICK_FUNCTION, onClickFunction); overrideSettings.Add(ControlLibConstants.VALIDATE_FORM, validateForm.ToString()); overrideSettings.Add(ControlLibConstants.ACTION_NAME, actionName); overrideSettings.Add(ControlLibConstants.IMAGE_PATH, imagePath); overrideSettings.Add(ControlLibConstants.CSS_CLASS, cssClass); SetStyleSettings(style, overrideSettings); return(overrideSettings); }
internal void Click_to_button(ButtonType _buttonName) { switch (_buttonName.ToString()) { case "Export": ExportButton.Click(); break; case "Import": ImportButton.Click(); break; case "Cancel": CancelButton.Click(); break; } }
/// <summary> /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本 Bootstrap Button 元素。 /// </summary> /// <param name="html">扩展方法实例。</param> /// <param name="text">显示在按钮上的文本。</param> /// <param name="icon">图标的css类。</param> /// <param name="type">按钮类型。</param> /// <param name="cssClass">按钮样式。</param> /// <param name="htmlAttributes">一个对象,其中包含要为该元素设置的 HTML 特性。</param> /// <returns>一个 Bootstrap Button元素。</returns> public static MvcHtmlString Button(this BootstrapHelper html, string text, string icon, ButtonType type, ButtonClass cssClass, object htmlAttributes, ButtonSize size = ButtonSize.nm) { TagBuilder tag = new TagBuilder("button"); IDictionary <string, object> attributes = BootstrapHelper.AnonymousObjectToHtmlAttributes(htmlAttributes); attributes.Add("type", type.ToString().ToLower()); tag.AddCssClass("btn btn-" + cssClass.ToString().ToLower()); tag.MergeAttributes(attributes); TagBuilder span = new TagBuilder("span"); span.AddCssClass(icon.Substring(0, icon.IndexOf('-')) + " " + icon); if (size != ButtonSize.nm) { tag.AddCssClass("btn-" + size.ToString()); } span.Attributes.Add("aria-hidden", "true"); tag.InnerHtml = span.ToString() + text; return(MvcHtmlString.Create(tag.ToString())); }
private static RibbonButton CreateButtonByType(RibbonBase MyRibbon, AddinModule Module, ButtonType BtnType) { var props = _ButtonProperties[BtnType]; RibbonButton btn = MyRibbon.Factory.CreateRibbonButton(); btn.Name = BtnType.ToString() + Module.Name; btn.Tag = Module.ShallowCopy(); btn.ControlSize = Microsoft.Office.Core.RibbonControlSize.RibbonControlSizeLarge; btn.Label = props.Label; btn.SuperTip = props.SuperTip; btn.OfficeImageId = props.OfficeImageId; btn.ShowImage = true; return btn; }
private MvcHtmlString Button(string text, string glyphicon, ButtonStyle style = ButtonStyle.Default, ButtonType type = ButtonType.Button) { var builder = new TagBuilder("button"); builder.MergeAttribute("class", "btn btn-" + style.ToString().ToLower()); builder.MergeAttribute("type", type.ToString().ToLower()); if (string.IsNullOrWhiteSpace(glyphicon)) { builder.InnerHtml = text; } else { var glyphiconBuilder = new TagBuilder("span"); glyphiconBuilder.MergeAttribute("class", glyphicon); builder.InnerHtml = glyphiconBuilder.ToString() + " " + text; } return MvcHtmlString.Create(builder.ToString()); }
public static MvcHtmlString Button(this HtmlHelper helper, ButtonType type, string value, object attributes) { return Button(helper, type.ToString(), value, attributes); }
public void SendButton(ButtonType bt) { _connection.SendMessageAsync($"type:button\nname:{bt.ToString()}\n\n"); }