public Button(string text, Vector2Int pos, bool selectable, ButtonTag tag) { this.position = pos; this.text = text; this.borderColor = ConsoleColor.Black; this.borderColor = ConsoleColor.Black; this.textColor = ConsoleColor.White; this.selectable = this.selectable; this.tag = tag; }
public Button(Texture2D image, Vector2 position, ButtonTag tag) { this.image = image; this.tag = tag; this.position = new Rectangle((int)position.X, (int)position.Y, image.Width, image.Height); startPosition = this.position; hoverPosition = this.position; hoverPosition.Y -= hoverChange; }
public static string MakeMouseClickCommand(ButtonTag tag, uint x, uint y) { var args = new MouseClickArgs() { Tag = tag, X = x, Y = y, }; var argsSerialize = JsonConvert.SerializeObject(args); return PluginCommandSerializeMaker.MakeCommand(InnerPluginName, "MouseClick", argsSerialize); }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { ButtonTag v = (ButtonTag)value; ButtonTag p; if (Enum.TryParse(parameter as string, out p)) { return((v & p) == p ? Visibility.Visible : Visibility.Collapsed); } return(Visibility.Collapsed); }
public static string MakeMouseClickCommand(ButtonTag tag, uint x, uint y) { var args = new MouseClickArgs() { Tag = tag, X = x, Y = y, }; var argsSerialize = JsonConvert.SerializeObject(args); return(PluginCommandSerializeMaker.MakeCommand(InnerPluginName, "MouseClick", argsSerialize)); }
public Button(string text, Vector2 pos, Color backgroundColor, Color fontColor, ButtonTag tag) { _pos = pos; _text = text; _backgroundColor = backgroundColor; _fontColor = fontColor; Tag = tag; _textWidth = (int)ContentManager.Instance.Fonts[ContentManager.FontTypes.Ui].MeasureString(_text).X; _textHeight = (int)ContentManager.Instance.Fonts[ContentManager.FontTypes.Ui].MeasureString(_text).Y; Bounds = new Rectangle((int)pos.X, (int)pos.Y, ((_buttonPadding * 2) + _textWidth), ((_buttonPadding * 2) + _textHeight)); }
public static string ToHtmlTag(this ButtonTag type) { switch (type) { case ButtonTag.Anchor: return("a"); case ButtonTag.Input: return("input"); case ButtonTag.InputSubmit: return("input"); default: return("button"); } }
// this function gets called whenever a row or column button is clicked void button_Click(object sender, RoutedEventArgs e) { Button button = (Button)sender; ButtonTag tag = (ButtonTag)(((Button)sender).Tag); bool state; if (tag.type == "C") // it's a column button { int columnNumber = tag.position; if (m_allChartsInColumnSelected[columnNumber]) { state = false; } else { state = true; } for (int r = 0; r < m_rows; r++) { m_chartSelected[r, columnNumber] = state; } } else if (tag.type == "R") // it's a row button { int rowNumber = tag.position; if (m_allChartsInRowSelected[rowNumber]) { state = false; } else { state = true; } for (int c = 0; c < m_cols; c++) { m_chartSelected[rowNumber, c] = state; } } UpdateSelectedCharts(); SetButtonStates(); }
public void CreateCheckbox() { var canvas = _pauseMenuManager.GetField <LevelBar, PauseMenuManager>("_levelBar") .transform .parent .parent .GetComponent <Canvas>(); if (!canvas) { return; } var buttonObj = new ButtonTag().CreateObject(canvas.transform); (buttonObj.transform as RectTransform).anchoredPosition = new Vector2(26, -15); (buttonObj.transform as RectTransform).sizeDelta = new Vector2(-130, 7); buttonObj.GetComponent <Button>().onClick.AddListener(ButtonClick); }
/// <summary> /// Select the item from the OptionTag / Drop List /// </summary> /// <param name="DropButton">DropButton Object</param> /// <param name="selectBox">Select Tag / List</param> /// <param name="itemName">Option Tag / List Item</param> public static void SelectOption(ButtonTag DropButton, SelectTag selectBox, string itemName) { try { Delay.Milliseconds(200); DropButton.PressKeys("{Enter}"); Delay.Milliseconds(200); Report.Info("Selecting item '" + itemName + "' in " + selectBox); // ignore case regex string itemRegex = "^(?i)" + Regex.Escape(itemName) + "$"; selectBox.EnsureVisible(); OptionTag option = selectBox.FindSingle <OptionTag>("option[@InnerText~'" + itemName + "']"); option.Selected = true; Delay.Milliseconds(200); option.PressKeys("{Enter}"); } catch (Exception ex) { Report.Info("INFO", "Fail SelectOption : " + ex.Message); } }
public static MvcHtmlString Alert(this HtmlHelper helper, AlertType type, string text, string header, ButtonTag? closeButton, bool block) { var builder = new TagBuilder("div"); if (block) builder.AddCssClass("alert-block"); builder.AddCssClass(type.ToCssClass()); builder.AddCssClass("alert"); if (closeButton.HasValue) { builder.InnerHtml += DismissButton(helper, closeButton.Value); } if (!string.IsNullOrEmpty(header)) { var headerTag = new TagBuilder("h4"); headerTag.SetInnerText(header); builder.InnerHtml = headerTag.ToString(); } builder.InnerHtml += text; return new MvcHtmlString(builder.ToString()); }
public ImageButtonBuilder Tag(ButtonTag tag) { component.Tag = tag; return(this); }
public static extern void MouseClick(ButtonTag tag, uint x, uint y);
public static MvcHtmlString Button(this HtmlHelper html, string text, ButtonTag tag, object htmlAttributes) { return(Button(html, text, ButtonType.Defualt, ButtonSize.Defualt, tag, false, false, htmlAttributes)); }
public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag, string text) { return(html.Button(text, tag, new { @class = "close", data_dismiss = "alert" })); }
public string ButtonTest(string text, ButtonType? type, ButtonSize? size, ButtonTag? tag, bool? block, bool? disabled) { return _html.Button(text, type, size, tag, block, disabled).ToHtmlString(); }
public static Button Button(this Bootstrap html, string text, ButtonType buttonType = ButtonType.Default, ButtonSize buttonSize = ButtonSize.Default, ButtonTag buttonTag = ButtonTag.Button, bool disabled = false, bool block = false, bool submit = true, object htmlAttributes = null) { return new Button(text, buttonType, buttonSize, buttonTag, disabled, block, submit); }
public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag) { return(html.Button(DefaultCloseSymbol, tag, new { @class = "close", data_dismiss = "alert" })); }
private void SetUpChartArrayButtons() { // clear any previously set up buttons from grids ColumnButtonGrid.Children.Clear(); ColumnButtonGrid.ColumnDefinitions.Clear(); RowButtonGrid.Children.Clear(); RowButtonGrid.RowDefinitions.Clear(); m_rowButton.Clear(); m_columnButton.Clear(); SolidColorBrush brush = new SolidColorBrush(m_buttonColorNotSelected); double fontSize; if (m_cols < 32) { fontSize = 10; } else { fontSize = 6; } for (int i = 0; i < m_cols; i++) { ColumnDefinition colDef = new ColumnDefinition(); ColumnButtonGrid.ColumnDefinitions.Add(colDef); Button button = new Button(); ButtonTag tag = new ButtonTag(); tag.type = "C"; tag.position = i; button.Tag = tag; TextBlock tb = new TextBlock(); tb.FontSize = fontSize; tb.Text = (i + 1).ToString(); button.Content = tb; button.Click += button_Click; ColumnButtonGrid.Children.Add(button); Grid.SetColumn(button, i); Grid.SetRow(button, 0); m_columnButton.Add(button); button.Background = brush; } for (int i = 0; i < m_rows; i++) { RowDefinition rowDef = new RowDefinition(); RowButtonGrid.RowDefinitions.Add(rowDef); Button button = new Button(); ButtonTag tag = new ButtonTag(); tag.type = "R"; tag.position = i; button.Tag = tag; int unicode; char character; string text; if (i < 26) { unicode = 65 + i; character = (char)unicode; text = character.ToString(); } else { unicode = 39 + i; character = (char)unicode; text = "A" + character.ToString(); } TextBlock tb = new TextBlock(); tb.FontSize = fontSize; tb.Text = text; button.Content = tb; button.Click += button_Click; RowButtonGrid.Children.Add(button); Grid.SetColumn(button, 0); Grid.SetRow(button, i); m_rowButton.Add(button); button.Background = brush; } }
public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag) { return html.Button(DefaultCloseSymbol, tag, new { @class = "close", data_dismiss = "alert" }); }
public static MvcHtmlString Button(this HtmlHelper html, string text, ButtonType? type, ButtonSize? size, ButtonTag? tag) { return Button(html, text, type, size, tag, false, false); }
public static MvcHtmlString Button(this HtmlHelper html, string text, ButtonTag tag, object htmlAttributes) { return Button(html, text, ButtonType.Default, ButtonSize.Default, tag, false, false, htmlAttributes); }
public static MvcHtmlString Button(this HtmlHelper html, string text, ButtonType? type, ButtonSize? size, ButtonTag? tag, bool? block, bool? disabled) { return Button(html, text, type, size, tag, block, disabled, null); }
public Button(ButtonTag tag) { Tag = tag; }
public static MvcHtmlString Button(this HtmlHelper html, string text, ButtonType? type, ButtonSize? size, ButtonTag? tag, bool? block, bool? disabled, object htmlAttributes) { var tagName = (tag.HasValue ? tag.Value : ButtonTag.Default).ToHtmlTag(); var builder = new TagBuilder(tagName); // Adding css styles if (disabled.HasValue && disabled.Value) { builder.AddCssClass("disabled"); builder.MergeAttribute("disabled", "disabled"); } if (block.HasValue && block.Value) builder.AddCssClass("btn-block"); if (size.HasValue && size.Value != ButtonSize.Default) builder.AddCssClass(size.Value.ToCssClass()); if (type.HasValue && type.Value != ButtonType.Default) builder.AddCssClass(type.Value.ToCssClass()); builder.AddCssClass(ButtonType.Default.ToCssClass()); // Adding html tag type var renderMode = TagRenderMode.Normal; if (tag.HasValue) { switch (tag) { case ButtonTag.Anchor: builder.MergeAttribute("href", "#"); builder.SetInnerText(text); break; case ButtonTag.InputSubmit: builder.MergeAttribute("type", "submit"); builder.MergeAttribute("value", text); renderMode = TagRenderMode.SelfClosing; break; default: builder.MergeAttribute("type", "button"); builder.SetInnerText(text); break; } } IDictionary<string, object> attributes; if (htmlAttributes is IDictionary<string, object>) attributes = (IDictionary<string, object>)htmlAttributes; else attributes = new RouteValueDictionary(htmlAttributes); builder.MergeAttributes(attributes, true); return new MvcHtmlString(builder.ToString(renderMode)); }
public static MvcHtmlString DismissButton(this HtmlHelper html, ButtonTag tag, string text) { return html.Button(text, tag, new { @class = "close", data_dismiss = "alert" }); }