private void AddButtonForKey(string key, bool allowMouse = false) { if (vertSpace >= rows * verticalSpacing) { horizSpace += horizontalSpacing; vertSpace = 0f; } SetButtonGUI sbg = (SetButtonGUI)Instantiate(setButtonPrefab); sbg.buttonName = key; sbg.buttonLabel.text = key + ":"; sbg.PrimaryLabel.text = FormatButtonText(cInput.GetText(key, 1)); sbg.SecondaryLabel.text = FormatButtonText(cInput.GetText(key, 2)); sbg.transform.parent = parentPoint; sbg.transform.localPosition = new Vector3(horizSpace, -vertSpace, 0f); sbg.transform.localScale = Vector3.one; sbg.PrimaryButton.sendMessage.gameObjectMessage.messageReceiver = gameObject; sbg.SecondaryButton.sendMessage.gameObjectMessage.messageReceiver = gameObject; if (allowMouse) { sbg.allowMouseAxis = true; sbg.allowJoystickAxis = true; } ButtonClass newButtonClass = new ButtonClass(); newButtonClass.buttonName = key; buttonList.Add(newButtonClass); controlButtons.Add(sbg.buttonName, sbg); vertSpace += verticalSpacing; }
public Form1() { InitializeComponent(); hozzaad = new ButtonClass(); sutinev = new TextBoxClass(); isCukormentes = new CheckBoxClass(); hozzaad.MouseClick += AddToData; this.flowLayoutPanel1.Controls.Add(sutinev); this.flowLayoutPanel1.Controls.Add(isCukormentes); this.flowLayoutPanel1.Controls.Add(hozzaad); }
static void Main() { //[A] Button 클래스의 인스턴스 생성 ButtonClass btn = new ButtonClass(); //[B] btn 개체의 Click 이벤트에 실행할 메서드들 등록 btn.Click += Hi1; // btn.Click += new ButtonClass.EventHandler(Hi1); btn.Click += Hi2; // btn.Click += new ButtonClass.EventHandler(Hi2); //[C] 이벤트 처리기(발생 메서드)를 통한 이벤트 발생: 다중 메서드 호출 btn.OnClick(); }
private void Start() { GameController = GameObject.Find("GameController"); Btn = transform.parent.gameObject; _objects = GameController.GetComponent <GameObjects>(); ButtonClass = transform.parent.GetComponent <ButtonClass>(); if (Buttontype == ButtonType.Fitts) { if (GetComponent <Renderer>().material.color != Color.red) { GetComponent <MyCollisionDetection>().enabled = false; } } }
/// <summary> /// Opens Manage Class Window and depending on the user (teacher/admin) the third parameter is either true or false /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void classButton_Click(object sender, EventArgs e) { panelTT.Hide(); ButtonClass classBtn = sender as ButtonClass; Class group = new Class(classBtn.name); if (status == "Teacher") { ManageClassWindow manageClass = new ManageClassWindow(group, connection, false); manageClass.Show(); } else { ManageClassWindow manageClass = new ManageClassWindow(group, connection, true); manageClass.Show(); } }
void OnGUI() { if (GUI.Button(BackButton.rect, BackButton.title)) { MenuController.ChangeMenu(BackButton.menuObject, this.gameObject); } int i = 0; foreach (Puzzle puzzle in puzzleParser.allPuzzles.levels[levelNum].puzzles) { GUI.enabled = currentPlayer.progress.Level[levelNum].puzzle.Count >= i; ButtonClass b = new ButtonClass(); b.title = puzzle.name; b.rect = new Rect(20 + 80 * i, 50, 70, 50); if (GUI.Button(b.rect, b.title)) { puzzleParser.currentPuzzle = puzzle; Application.LoadLevel("Game"); } i++; } }
/// <summary> /// Generates the list of classes of the teacher on the "general" panel /// A messag is shown if the teacher doesn't have a classe yet /// </summary> private void ShowClasses() { String query = "Select className from users Where userID = '" + Teacher.ID + "'"; MySqlDataAdapter SDA = new MySqlDataAdapter(query, connection); DataTable classes = new DataTable(); SDA.Fill(classes); if (classes.Rows.Count > 0) { string[] classesTab = classes.Rows[0]["className"].ToString().Split(' '); if (classesTab[0] != "") { Label lbl = new Label(); lbl.AutoSize = true; lbl.Location = new System.Drawing.Point(0, 25); lbl.Text = "M. " + Teacher.name + " has " + (classesTab.Length) + " classes : "; classesPanel.Controls.Add(lbl); int y = 50; for (int i = 0; i < classesTab.Length; i++) { string name = classesTab[i]; ButtonClass classButton = new ButtonClass(name); classButton.Text = "Class " + name; classButton.Location = new System.Drawing.Point(0, y); classesPanel.Controls.Add(classButton); y += 25; classButton.Click += new EventHandler(classButton_Click); } } else { Label lbl = new Label(); lbl.AutoSize = true; lbl.Location = new System.Drawing.Point(0, 25); lbl.Text = "M. " + Teacher.name + " has zero classes at the moment"; classesPanel.Controls.Add(lbl); } } }
public void ListSignatures(ListSignaute Signatures) { int c = 0; if (clicked == false) { Debug.Log("Comenzando..."); for (int i = 0; i < Signatures.GetEnumerato(); i++) { var btn = Instantiate(button); btn.SetActive(true); ButtonClass btnblocks = btn.GetComponent <ButtonClass>(); btnblocks.SetName(Signatures.getInd(i).title + Signatures.getInd(i).hourBegin); btnblocks.setBlock(Signatures.getInd(i).block); int x = 0; int y = c; int z = 0; c = c + 150; btn.transform.SetParent(scrollBox.transform, false); btn.transform.parent = scrollBox.transform; RectTransform rt = btn.GetComponent <RectTransform>(); rt.anchoredPosition = rt.transform.position; rt.localPosition = new Vector2(0, -y); // btn.transform.SetPositionAndRotation(pos,scrollBox.transform.localRotation); } } else { actualzar(); } clicked = !clicked; }
private void Start() { InitializeVariables(); thisButton = shopManager.GetButtonClass(indexOfThisTower); Invoke("SetCanvas", 0.1f); }
/// <summary> /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本 Bootstrap Button 元素。 /// </summary> /// <param name="html">此方法扩展的 HTML 帮助器实例。</param> /// <param name="text">显示在按钮上的文本。</param> /// <param name="icon">图标的css类。</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, ButtonClass cssClass, object htmlAttributes) { return(Button(html, text, icon, ButtonType.Button, cssClass, null)); }
/// <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())); }
public void AddInput(Type type, string name, out Point p) { TextBox textB; ComboBox comboBox; Label label = new Label(); label.Content = name; Binding binding = new Binding(); binding.ElementName = name; switch (Type.GetTypeCode(type)) { case TypeCode.String: textB = new TextBox(); //textB.Width = 120; textB.Height = 17; textB.Name = name; //Grid.SetRow(textB, (int)p.Y); //Grid.SetColumn(textB, (int)p.X); label.SetBinding(TextBlock.TextProperty, binding); StackP.Children.Add(label); StackP.Children.Add(textB); break; case TypeCode.DateTime: DatePicker datePicker = new DatePicker(); datePicker.Name = name; //Grid.SetRow(datePicker, (int)p.Y); //Grid.SetColumn(datePicker, (int)p.X); label.SetBinding(TextBlock.TextProperty, binding); StackP.Children.Add(label); StackP.Children.Add(datePicker); break; case TypeCode.Int32: case TypeCode.Int64: case TypeCode.Single: textB = ButtonClass.CreteTextBox(type); textB.Name = name; //Grid.SetRow(textB, (int)p.Y); //Grid.SetColumn(textB, (int)p.X); label.SetBinding(TextBlock.TextProperty, binding); StackP.Children.Add(label); StackP.Children.Add(textB); break; case TypeCode.Object: if (type == typeof(Provider) || type == typeof(Invoice) || type == typeof(Goods)) { comboBox = ButtonClass.CreteComboBox(type); comboBox.Name = name; //Grid.SetRow(comboBox, (int)p.Y); //Grid.SetColumn(comboBox, (int)p.X); label.SetBinding(TextBlock.TextProperty, binding); StackP.Children.Add(label); StackP.Children.Add(comboBox); } break; default: MessageBox.Show("Тип не опреділився (Error521).", "Error", MessageBoxButton.OK, MessageBoxImage.Error); throw new IndexOutOfRangeException(); } p.Y += 1; }
public int ChooseDirection(ButtonClass.button b1, ButtonClass.button b2) { if (b1.timer>b2.timer) return 1; else if (b1.timer<b2.timer) return -1; else return 0; }
public override void Process(TagHelperContext context, TagHelperOutput output) { Dictionary <string, string> Routes = new Dictionary <string, string>(Options.FilterList); if (Options.SelectedSort != null) { Routes.Add("SelectedSort", Options.SelectedSort); } Routes.Add("pageSize", Options.PaginationOptions.PageSize.ToString()); foreach (var route in _routeValues) { Routes.TryAdd(route.Key, route.Value); } output.TagName = "div"; output.Attributes.Add("class", "btn-group"); var btn = new TagBuilder("button"); List <string> clist = new List <string>(); btn.AddCssClass("btn"); clist.Add("btn"); foreach (var cls in ButtonClass.Split(' ', StringSplitOptions.RemoveEmptyEntries)) { if (!clist.Contains(cls)) { btn.AddCssClass(cls); clist.Add(cls); } } //btn.AddCssClass("btn-outline-secondary"); //btn.AddCssClass("btn-sm"); btn.InnerHtml.Append(LableName); output.Content.AppendHtml(btn); var dbtn = new TagBuilder("button"); dbtn.AddCssClass("btn"); dbtn.AddCssClass("btn-outline-secondary"); dbtn.AddCssClass("dropdown-toggle"); dbtn.AddCssClass("dropdown-toggle-split"); dbtn.Attributes.Add("type", "button"); dbtn.Attributes.Add("data-toggle", "dropdown"); dbtn.Attributes.Add("aria-haspopup", "true"); dbtn.Attributes.Add("aria-expanded", "false"); var span = new TagBuilder("span"); span.AddCssClass("sr-only"); span.InnerHtml.Append("Toggle Dropdown"); dbtn.InnerHtml.AppendHtml(span); output.Content.AppendHtml(dbtn); var menu = new TagBuilder("div"); menu.AddCssClass("dropdown-menu"); if (CanEdit) { var editLink = _generator.GenerateActionLink(ViewContext, "Edit", "Edit", null, null, null, null, Routes, new { @class = "dropdown-item" }); menu.InnerHtml.AppendHtml(editLink); } if (CanDelete) { var deleteLink = _generator.GenerateActionLink(ViewContext, "Delete", "Delete", null, null, null, null, Routes, new { @class = "dropdown-item" }); menu.InnerHtml.AppendHtml(deleteLink); } if (CanView) { var detailsLink = _generator.GenerateActionLink(ViewContext, "Details", "Details", null, null, null, null, Routes, new { @class = "dropdown-item" }); menu.InnerHtml.AppendHtml(detailsLink); } output.Content.AppendHtml(menu); }
public static MvcHtmlString MyButton(this HtmlHelper helper, string id, ButtonClass buttonClass, string value, IconClass?icon = null, string controller = "", string view = "") { string btn = string.Format("<a id='{0}' href='{5}' type='submit' class='btn btn-{1}'><span class='glyphicon glyphicon-{3}'></span>{2}</a>", id, buttonClass, value, icon, controller, view); return(MvcHtmlString.Create(btn)); }
/// <summary> /// 通过使用指定的 HTML 帮助器和窗体字段的名称,返回文本 Bootstrap Button 元素。 /// </summary> /// <param name="html">此方法扩展的 HTML 帮助器实例。</param> /// <param name="text">显示在按钮上的文本。</param> /// <param name="icon">图标的css类。</param> /// <param name="type">按钮类型。</param> /// <param name="cssClass">按钮样式。</param> /// <returns>一个 Bootstrap Button元素。</returns> public static MvcHtmlString Button(this BootstrapHelper html, string text, string icon, ButtonType type, ButtonClass cssClass) { return(Button(html, text, icon, type, cssClass, null)); }
public static MvcHtmlString MyButtonInput(this HtmlHelper helper, string id, ButtonClass buttonClass, string value, IconClass?icon = null, string controller = "", string view = "") { string btn = string.Format("<input id='{0}' type='submit' class='btn btn-{1}' value='{2}'/>", id, buttonClass, value, icon, controller, view); return(MvcHtmlString.Create(btn)); }
public static void Init(AppPressDemo a, ButtonClass Button) { Button.Help.val = "<a href='https://docs.google.com/document/d/1goW6BxoZp1WK12ZCcmg8RqVgADifn8yYZSZoGjpUeRo/edit#heading=h.9mk6rk14f2u' target='_blank'><i class=\"fa fa-question-circle\"></i></a>"; Button.Button.Help = "Prints the Content of Text Area Rich Field above as PDF<br/>Look at the implementation to find how to get the Text Area Rich Field"; }