public override void Awake() { base.Awake(); showButton = GetComponentInChildren <button>(); tex = new Texture2D(4, 4, TextureFormat.DXT1, false); texSphere.parent = null; texSphere.position = Vector3.zero; texSphere.rotation = Quaternion.identity; }
public void shiftButtons() { button temp = buttons[0]; for (int i = 0; i < buttons.Length - 1; i++) { buttons[i] = buttons[i + 1]; } buttons[buttons.Length - 1] = temp; }
public void chkEvent(object sender, EventArgs e) { Control ctrl = (Control)sender; button c = ctrl.Tag as button; id = long.Parse(c.index.ToString()); DataRow r = m.getrowbyid(dt, "id=" + id); ma = (r != null)?r["ma"].ToString():""; m.close(); this.Close(); }
public async Task ShouldClickAnOffscreenElementWhenScrollBehaviorIsSmooth() { await Page.SetContentAsync(@$ " <div style=" "border: 1px solid black; height: 500px; overflow: auto; width: 500px; scroll-behavior: smooth" "> <button style=" "margin-top: 2000px" " onClick=" "window.clicked = true" " >hi</button> </div>"); await Page.ClickAsync("button"); Assert.True(await Page.EvaluateAsync <bool>("window.clicked")); }
// If no item was selected, selected is set to the appropriate end of the list private bool changeSelectionNew(button d) { Debug.Print("Setting Selection"); if (d == button.up) { selected = menuItems.Count - 1; return(true); } if (d == button.down) { selected = 0; return(true); } return(false); }
public ArrayList getArrayButton(string storeID, string sectionName) { ArrayList mangButton = new ArrayList(); DataTable tbl = getGui.get_Array_button(storeID, sectionName); for (int i = 0; i < tbl.Rows.Count; i++) { int x = (int)tbl.Rows[i][4]; int y = (int)tbl.Rows[i][5]; int height = (int)tbl.Rows[i][6]; int width = (int)tbl.Rows[i][7]; var tmpBut = new button(x, y, width, height); mangButton.Add(tmpBut); } return(mangButton); }
public FrmBanHang formBanHang; // Xu ly transfer public FrmLayout() { InitializeComponent(); sections = new ArrayList(); for (int i = 1; i < 8; i++) { sections.Add(i.ToString()); ArrayList tmp = new ArrayList(); button aa = new button(100, 100, 50, 50); aa.Text = i.ToString(); tmp.Add(aa); PanelLayout panel = new PanelLayout(tmp, i.ToString()); listPanel.Add(i.ToString(), panel); this.Controls.Add((PanelLayout)listPanel[i.ToString()]); } }
private void changeColorButton(int x) { for (int i = 1; i <= x; i++) { button tmp = (button)buttonKhu[i - 1]; tmp.Text = sections[(pageIndex - 1) * 4 + i - 1].ToString(); tmp.Visible = true; if ((pageIndex - 1) * 4 + i == selectedSection) { tmp.changeColor(Color.White, Color.Red); } else { tmp.changeColor(Color.White, Color.Blue); } } }
// Use this for initialization void Start() { fx = GetComponent <AudioSource>(); player = GameObject.FindGameObjectWithTag("Player"); bo = GetComponent <beatObject>(); active = false; ray = transform.GetChild(0).gameObject; ray.transform.localPosition = new Vector3(0, 0, range); ray.transform.localScale = new Vector3(ray.transform.localScale.x, range, ray.transform.localScale.z); ray.SetActive(false); if (activation != Mode.Button) { InvokeRepeating("Fire", bo.offset, bo.rate); } else { but = button.GetComponent <button> (); } }
public void LoadMatHang() { for (int i = (pageIndexMatHang - 1) * 28; i < pageIndexMatHang * 28; i++) { int a = i - (pageIndexMatHang - 1) * 28 + 15; button tmp = (button)panel2.Controls["button" + a.ToString()]; if (i < listMatHang.Count) { tmp.Text = listMatHang[i].ToString(); tmp.Ident = listIdMatHang[i].ToString(); tmp.Visible = true; } else { tmp.Visible = false; } } this.Refresh(); }
/// <summary> /// Добавить вложеную группу, как dropdown menus /// </summary> /// <param name="nesting">Набор вложеной группы кнопок</param> /// <param name="id_node">Уникальный идентификатор вложеного узла. Если IsNullOrEmpty => будет сгенерирован guid</param> public void AddNestingDropdownGroup(List <DataParticleItem> nesting, string title_node, string id_node = null) { if (string.IsNullOrEmpty(id_node)) { id_node = Guid.NewGuid().ToString().Replace("-", ""); } GroupElements nested_group = new GroupElements() { aria_label = "nested group - " + id_node }; button node_button = new button(title_node) { Id_DOM = id_node }; node_button.AddCSS("btn btn-" + default_style.ToString() + " dropdown-toggle", true); node_button.SetAttribute("data-toggle", "dropdown"); node_button.SetAttribute("aria-haspopup", "true"); node_button.SetAttribute("aria-expanded", "false"); nested_group.Childs.Add(node_button); div dropdown_node = new div(); dropdown_node.AddCSS("dropdown-menu"); dropdown_node.SetAttribute("aria-labelledby", id_node); foreach (DataParticleItem item in nesting) { using (a a_item = new a() { href = item.Value, InnerText = item.Title }) { a_item.AddCSS("dropdown-item"); dropdown_node.AddDomNode(a_item); } } Childs.Add(nested_group); }
private void freq(button Alhoritm) { switch (Alhoritm) { case button.Sum: statistic.GetSum((int)nudNumber.Value, nudMean.Value, numericUpDown2.Value); break; case button.Enh: statistic.GetAbsSum((int)nudNumber.Value, nudMean.Value, numericUpDown2.Value); break; case button.BoxMuller: statistic.GetBox((int)nudNumber.Value, nudMean.Value, numericUpDown2.Value); break; } decimal[] Freq = statistic.GetStats(); chart.Series[0].Points.Clear(); double ai = statistic.a; chart.ChartAreas[0].Axes[0].Interval = ((double)(statistic.b - statistic.a)) / 5; for (int i = 0; i < Freq.Length; i++) { chart.Series[0].Points.AddXY(ai + ((double)(statistic.b - statistic.a)) / 10, Math.Round((double)Freq[i], 3)); ai += ((double)(statistic.b - statistic.a)) / 5; } chart.ChartAreas[0].Axes[0].Maximum = statistic.b; statistic.GetMean(); average.Text = "Average: " + statistic.absAvg + "(" + statistic.error1 + "% error)"; variance.Text = "Variance: " + statistic.absVar + "(" + statistic.error2 + "% error)"; chi.Text = statistic.GetChi(); dist(nudMean.Value, numericUpDown2.Value); }
/// <summary> /// Сформировать кнопку /// </summary> /// <param name="text">Текст кнопки</param> /// <param name="href">Ссылка (если требуетс кнопка-ссылка)</param> /// <param name="style">Стиль оформления кнопки</param> /// <param name="size">Размер кнопки</param> /// <param name="btn_block">Флаг режима заполнения родительского блока во всю ширину</param> /// <param name="outline_style">Флаг отключения цвета фона. В этом режиме стиль оформления будет использован для рамки и цвета, но не для фона</param> public static button GetButton(string text, string id_button = null, string href = null, VisualBootstrapStylesEnum?style = null, SizingBootstrap?size = null, bool btn_block = false, bool outline_style = false) { button ret_button = new button(text) { Id_DOM = id_button }; ret_button.AddCSS("btn"); if (!(style is null)) { ret_button.AddCSS("btn" + (outline_style ? "-outline-" : "-") + style?.ToString("g")); } if (!(size is null)) { ret_button.AddCSS("btn-" + size?.ToString("g").ToLower()); } if (btn_block) { ret_button.AddCSS("btn-block"); } ret_button.AddCSS("active"); if (string.IsNullOrEmpty(href)) { ret_button.SetAttribute("type", "button"); } else { ret_button.tag_custom_name = "a"; ret_button.SetAttribute("href", href); ret_button.SetAttribute("role", "button"); ret_button.SetAttribute("aria-pressed", "true"); } return(ret_button); }
private void WhileAction(GameObject panelObj) { button whileButtonCs = panelObj.GetComponent <button>(); List <GameObject> whilePanelList = whileButtonCs.GetWhilePanelList(); if (whilePanelList == null) { panelIndex++; return; } int whileCountMax = whileButtonCs.GetWhileCount(); if (whileCountMax > whileCount) { if (whilePanelList.Count > whileIndex) { GameObject whilePanel = whilePanelList[whileIndex]; MoveCommand(whilePanel); if (moveCount == 0) { whileIndex++; panelIndex--; } } else { whileIndex = 0; whileCount++; } } else { whileCount = 0; panelIndex++; } }
public void resetButton(button b) { int chance = Random.Range(0, 100); if (chance < 35) { b.plantID = 0; } else if (chance < 70) { b.plantID = 1; } else if (chance < 85) { b.plantID = 2; } else { b.plantID = 3; } b.GetComponent <Image>().sprite = plantIcons[b.plantID]; b.GetComponent <Image>().enabled = true; b.GetComponent <Button>().interactable = true; }
public void killButton(button b) { b.GetComponent <Image>().enabled = false; b.GetComponent <Button>().interactable = true; }
/// <summary> /// Map an action in a windowmap based on the id and key xml nodes. /// </summary> /// <param name="map">The windowmap that needs to be filled in.</param> /// <param name="nodeId">The id of the action</param> /// <param name="nodeGamepad">The key corresponding to the mapping.</param> private static void MapAction(ref WindowMap map, XmlNode nodeId, XmlNode nodeGamepad, XmlNode nodeSound) { if (null == nodeId) { return; } button but = new button(); but.eAction = (Action.ActionType)Int32.Parse(nodeId.InnerText); but.m_strSoundFile = ""; if (nodeSound != null && nodeSound.InnerText != null) { but.m_strSoundFile = nodeSound.InnerText; } if (nodeGamepad != null) { string strButton = nodeGamepad.InnerText.ToLower(); if (strButton.Length == 1) { but.eKeyChar = (int)strButton[0]; but.eKeyCode = 0; } else { but.eKeyChar = 0; strButton = strButton.ToLower(); switch (strButton) { case "f1": but.eKeyCode = (int)Keys.F1; break; case "f2": but.eKeyCode = (int)Keys.F2; break; case "f3": but.eKeyCode = (int)Keys.F3; break; case "f4": but.eKeyCode = (int)Keys.F4; break; case "f5": but.eKeyCode = (int)Keys.F5; break; case "f6": but.eKeyCode = (int)Keys.F6; break; case "f7": but.eKeyCode = (int)Keys.F7; break; case "f8": but.eKeyCode = (int)Keys.F8; break; case "f9": but.eKeyCode = (int)Keys.F9; break; case "f10": but.eKeyCode = (int)Keys.F10; break; case "f11": but.eKeyCode = (int)Keys.F11; break; case "f12": but.eKeyCode = (int)Keys.F12; break; case "backspace": but.eKeyCode = (int)Keys.Back; break; case "tab": but.eKeyCode = (int)Keys.Tab; break; case "end": but.eKeyCode = (int)Keys.End; break; case "insert": but.eKeyCode = (int)Keys.Insert; break; case "home": but.eKeyCode = (int)Keys.Home; break; case "pageup": but.eKeyCode = (int)Keys.PageUp; break; case "pagedown": but.eKeyCode = (int)Keys.PageDown; break; case "left": but.eKeyCode = (int)Keys.Left; break; case "right": but.eKeyCode = (int)Keys.Right; break; case "up": but.eKeyCode = (int)Keys.Up; break; case "down": but.eKeyCode = (int)Keys.Down; break; case "enter": but.eKeyCode = (int)Keys.Enter; break; case "delete": but.eKeyCode = (int)Keys.Delete; break; case "pause": but.eKeyCode = (int)Keys.Pause; break; case "print": but.eKeyCode = (int)Keys.PrintScreen; break; case "escape": but.eKeyCode = (int)Keys.Escape; break; case "esc": but.eKeyCode = (int)Keys.Escape; break; case "apps": but.eKeyCode = (int)Keys.Apps; break; case "win": but.eKeyCode = (int)Keys.LWin; break; case "space": but.eKeyCode = 0; but.eKeyChar = 32; break; } } } map.mapButtons.Add(but); }
public static string[] GetRecipients(string buttonId, string controlId) { // Get the installation path DirectoryInfo installationPath = GetInstallationPath(); string[] recipients = new string[3]; bool foundrecipients = false; XmlSerializer deserializer = new XmlSerializer(typeof(menu)); menu cvmenu; FileInfo f = new FileInfo(Path.Combine(installationPath.FullName, @"Buttons\" + buttonId + @"\button.xml")); using (FileStream buttonStream = new FileStream(f.FullName, FileMode.Open, FileAccess.Read)) { cvmenu = (menu)deserializer.Deserialize(buttonStream); } foreach (var item in cvmenu.Items) { if (foundrecipients) { break; } if (item is button) { button b = (button)item; if (b.id == controlId) { if (!string.IsNullOrEmpty(b.toRecipients)) { recipients[0] = b.toRecipients; recipients[1] = b.ccRecipients; recipients[2] = b.bccRecipients; foundrecipients = true; } break; } } else if (item is menu) { menu m = (menu)item; foreach (var b in m.Items) { if (b is button) { button bb = (button)b; if (bb.id == controlId) { if (!string.IsNullOrEmpty(bb.toRecipients)) { recipients[0] = bb.toRecipients; recipients[1] = bb.ccRecipients; recipients[2] = bb.bccRecipients; foundrecipients = true; } break; } } } } } if (!foundrecipients) { deserializer = new XmlSerializer(typeof(ButtonConfiguration)); ButtonConfiguration buttonConfig; f = new FileInfo(Path.Combine(installationPath.FullName, @"Buttons\" + buttonId + @"\config.xml")); using (FileStream buttonStream = new FileStream(f.FullName, FileMode.Open, FileAccess.Read)) { buttonConfig = (ButtonConfiguration)deserializer.Deserialize(buttonStream); } recipients[0] = buttonConfig.toRecipients; recipients[1] = buttonConfig.ccRecipients; recipients[2] = buttonConfig.bccRecipients; } return(recipients); }
void Awake() { player = GetComponent <clipPlayerSimple>(); muteButton = GetComponentInChildren <button>(); jackout = GetComponentInChildren <omniJack>(); }
public wx_menu ConverTowx_menu(wxmenu wxmenu) { wx_menu m = new wx_menu(); #region 菜单1 if (wxmenu.menu.button.Length >= 1) { button btn = wxmenu.menu.button[0]; m.cbxEnable1 = true; if (btn.sub_button.Length == 0) { m.txtbtnName1 = btn.name; m.rdotp1 = "0"; m.txtbtntp1 = btn.type; switch (btn.type) { case "click": m.txtbtnvalue1 = btn.key; break; case "view": m.txtbtnvalue1 = btn.url; break; default: break; } } else { m.txtmenuName1 = btn.name; m.rdotp1 = "1"; #region 子按钮列表1-5 if (btn.sub_button.Length >= 1) { sub_button sbtn = btn.sub_button[0]; m.txtsubbtnName1 = sbtn.name; m.txtsubbtntp1 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue1 = sbtn.key; break; case "view": m.txtsubbtnvalue1 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 2) { sub_button sbtn = btn.sub_button[1]; m.txtsubbtnName2 = sbtn.name; m.txtsubbtntp2 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue2 = sbtn.key; break; case "view": m.txtsubbtnvalue2 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 3) { sub_button sbtn = btn.sub_button[2]; m.txtsubbtnName3 = sbtn.name; m.txtsubbtntp3 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue3 = sbtn.key; break; case "view": m.txtsubbtnvalue3 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 4) { sub_button sbtn = btn.sub_button[3]; m.txtsubbtnName4 = sbtn.name; m.txtsubbtntp4 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue4 = sbtn.key; break; case "view": m.txtsubbtnvalue4 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 5) { sub_button sbtn = btn.sub_button[4]; m.txtsubbtnName5 = sbtn.name; m.txtsubbtntp5 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue5 = sbtn.key; break; case "view": m.txtsubbtnvalue5 = sbtn.url; break; default: break; } } #endregion } } #endregion #region 菜单2 if (wxmenu.menu.button.Length >= 2) { button btn = wxmenu.menu.button[1]; m.cbxEnable2 = true; if (btn.sub_button.Length == 0) { m.txtbtnName2 = btn.name; m.rdotp2 = "0"; m.txtbtntp2 = btn.type; switch (btn.type) { case "click": m.txtbtnvalue2 = btn.key; break; case "view": m.txtbtnvalue2 = btn.url; break; default: break; } } else { m.txtmenuName2 = btn.name; m.rdotp2 = "1"; #region 子按钮列表6-10 if (btn.sub_button.Length >= 1) { sub_button sbtn = btn.sub_button[0]; m.txtsubbtnName6 = sbtn.name; m.txtsubbtntp6 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue6 = sbtn.key; break; case "view": m.txtsubbtnvalue6 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 2) { sub_button sbtn = btn.sub_button[1]; m.txtsubbtnName7 = sbtn.name; m.txtsubbtntp7 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue7 = sbtn.key; break; case "view": m.txtsubbtnvalue7 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 3) { sub_button sbtn = btn.sub_button[2]; m.txtsubbtnName8 = sbtn.name; m.txtsubbtntp8 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue8 = sbtn.key; break; case "view": m.txtsubbtnvalue8 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 4) { sub_button sbtn = btn.sub_button[3]; m.txtsubbtnName9 = sbtn.name; m.txtsubbtntp9 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue9 = sbtn.key; break; case "view": m.txtsubbtnvalue9 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 5) { sub_button sbtn = btn.sub_button[4]; m.txtsubbtnName10 = sbtn.name; m.txtsubbtntp10 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue10 = sbtn.key; break; case "view": m.txtsubbtnvalue10 = sbtn.url; break; default: break; } } #endregion } } #endregion #region 菜单3 if (wxmenu.menu.button.Length >= 3) { button btn = wxmenu.menu.button[2]; m.cbxEnable3 = true; if (btn.sub_button.Length == 0) { m.txtbtnName3 = btn.name; m.rdotp3 = "0"; m.txtbtntp3 = btn.type; switch (btn.type) { case "click": m.txtbtnvalue3 = btn.key; break; case "view": m.txtbtnvalue3 = btn.url; break; default: break; } } else { m.txtmenuName3 = btn.name; m.rdotp3 = "1"; #region 子按钮列表11-15 if (btn.sub_button.Length >= 1) { sub_button sbtn = btn.sub_button[0]; m.txtsubbtnName11 = sbtn.name; m.txtsubbtntp11 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue11 = sbtn.key; break; case "view": m.txtsubbtnvalue11 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 2) { sub_button sbtn = btn.sub_button[1]; m.txtsubbtnName12 = sbtn.name; m.txtsubbtntp12 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue12 = sbtn.key; break; case "view": m.txtsubbtnvalue12 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 3) { sub_button sbtn = btn.sub_button[2]; m.txtsubbtnName13 = sbtn.name; m.txtsubbtntp13 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue13 = sbtn.key; break; case "view": m.txtsubbtnvalue13 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 4) { sub_button sbtn = btn.sub_button[3]; m.txtsubbtnName14 = sbtn.name; m.txtsubbtntp14 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue14 = sbtn.key; break; case "view": m.txtsubbtnvalue14 = sbtn.url; break; default: break; } } if (btn.sub_button.Length >= 5) { sub_button sbtn = btn.sub_button[4]; m.txtsubbtnName15 = sbtn.name; m.txtsubbtntp15 = sbtn.type; switch (sbtn.type) { case "click": m.txtsubbtnvalue15 = sbtn.key; break; case "view": m.txtsubbtnvalue15 = sbtn.url; break; default: break; } } #endregion } } #endregion return(m); }
private void BuildMenu(Office.CommandBarPopup menuBar, IEnumerable <menu> buttons) { int customButtonPosition = 1; foreach (menu customButton in buttons) { Office.CommandBarPopup addInButton = (Office.CommandBarPopup)menuBar.Controls.Add(Office.MsoControlType.msoControlPopup, this.missing, this.missing, customButtonPosition++, true); addInButton.Caption = customButton.label; for (int i = 0; i < customButton.Items.Length; i++) { if (customButton.Items[i] is menu) { menu categoryMenu = (menu)customButton.Items[i]; Office.CommandBarPopup categoryButton = (Office.CommandBarPopup)addInButton.Controls.Add(Office.MsoControlType.msoControlPopup, this.missing, this.missing, i + 1, true); categoryButton.Caption = categoryMenu.label; categoryButton.Tag = categoryMenu.id; // the name of the menu is the name of the file if (categoryMenu.Items.Length > 0) { for (int j = 0; j < categoryMenu.Items.Length; j++) { button actionMenu = (button)categoryMenu.Items[j]; Office.CommandBarButton actionButton = (Office.CommandBarButton)categoryButton.Controls.Add(Office.MsoControlType.msoControlButton, this.missing, this.missing, j + 1, true); actionButton.Caption = actionMenu.label; switch (actionMenu.onAction) { case "SendNormal": actionButton.Click += this.HandleMenuClickNormal; break; case "SendHigh": actionButton.Click += this.HandleMenuClickHigh; break; case "SendLow": actionButton.Click += this.HandleMenuClickLow; break; case "Guidance": actionButton.Click += this.HandleMenuClickGuidance; break; } actionButton.Tag = actionMenu.tag; actionButton.DescriptionText = actionMenu.id; } } } else if (customButton.Items[i] is button) { button actionMenu = (button)customButton.Items[i]; Office.CommandBarButton actionButton = (Office.CommandBarButton)addInButton.Controls.Add(Office.MsoControlType.msoControlButton, this.missing, this.missing, i + 1, true); actionButton.Caption = actionMenu.label; switch (actionMenu.onAction) { case "SendNormal": actionButton.Click += this.HandleMenuClickNormal; break; case "SendHigh": actionButton.Click += this.HandleMenuClickHigh; break; case "SendLow": actionButton.Click += this.HandleMenuClickLow; break; case "Guidance": actionButton.Click += this.HandleMenuClickGuidance; break; } actionButton.Tag = actionMenu.tag; actionButton.DescriptionText = actionMenu.id; } else if (customButton.Items[i] is menuSeparator) { menuSeparator sep = (menuSeparator)customButton.Items[i]; Office.CommandBarButton actionButton = (Office.CommandBarButton)addInButton.Controls.Add(Office.MsoControlType.msoControlButton, this.missing, this.missing, i + 1, true); actionButton.BeginGroup = true; actionButton.Caption = sep.title; if (string.IsNullOrEmpty(sep.title)) { actionButton.Visible = false; } actionButton.Enabled = false; } } } }
public void onNoButtonClick() { buttonPressed(); pressedButton = button.NO_BUTTON; }
public void onYesButtonClick() { buttonPressed(); pressedButton = button.YES_BUTTON; }
/// <summary> /// Map an action in a windowmap based on the id and key xml nodes. /// </summary> /// <param name="map">The windowmap that needs to be filled in.</param> /// <param name="nodeId">The id of the action</param> /// <param name="nodeGamepad">The key corresponding to the mapping.</param> private static void MapAction(ref WindowMap map, XmlNode nodeId, XmlNode nodeGamepad, XmlNode nodeSound) { if (null == nodeId) { return; } button but = new button(); but.eAction = (Action.ActionType)Int32.Parse(nodeId.InnerText); but.m_strSoundFile = ""; if (nodeSound != null && nodeSound.InnerText != null) { but.m_strSoundFile = nodeSound.InnerText; } if (nodeGamepad != null) { string strButton = nodeGamepad.InnerText.ToLower(); if (strButton.Length == 1) { but.eKeyChar = (int)strButton[0]; but.eKeyCode = 0; } else { but.eKeyChar = 0; strButton = strButton.ToLower(); switch (strButton) { case "f1": but.eKeyCode = (int)Keys.F1; break; case "f2": but.eKeyCode = (int)Keys.F2; break; case "f3": but.eKeyCode = (int)Keys.F3; break; case "f4": but.eKeyCode = (int)Keys.F4; break; case "f5": but.eKeyCode = (int)Keys.F5; break; case "f6": but.eKeyCode = (int)Keys.F6; break; case "f7": but.eKeyCode = (int)Keys.F7; break; case "f8": but.eKeyCode = (int)Keys.F8; break; case "f9": but.eKeyCode = (int)Keys.F9; break; case "f10": but.eKeyCode = (int)Keys.F10; break; case "f11": but.eKeyCode = (int)Keys.F11; break; case "f12": but.eKeyCode = (int)Keys.F12; break; case "backspace": but.eKeyCode = (int)Keys.Back; break; case "tab": but.eKeyCode = (int)Keys.Tab; break; case "end": but.eKeyCode = (int)Keys.End; break; case "insert": but.eKeyCode = (int)Keys.Insert; break; case "home": but.eKeyCode = (int)Keys.Home; break; case "pageup": but.eKeyCode = (int)Keys.PageUp; break; case "pagedown": but.eKeyCode = (int)Keys.PageDown; break; case "left": but.eKeyCode = (int)Keys.Left; break; case "right": but.eKeyCode = (int)Keys.Right; break; case "up": but.eKeyCode = (int)Keys.Up; break; case "down": but.eKeyCode = (int)Keys.Down; break; case "enter": but.eKeyCode = (int)Keys.Enter; break; case "delete": but.eKeyCode = (int)Keys.Delete; break; case "pause": but.eKeyCode = (int)Keys.Pause; break; case "print": but.eKeyCode = (int)Keys.PrintScreen; break; case "escape": but.eKeyCode = (int)Keys.Escape; break; case "esc": but.eKeyCode = (int)Keys.Escape; break; case "apps": but.eKeyCode = (int)Keys.Apps; break; case "win": but.eKeyCode = (int)Keys.LWin; break; case "space": but.eKeyCode = 0; but.eKeyChar = 32; break; } } } map.mapButtons.Add(but); }
/// <summary> /// Сформировать модальное окно /// </summary> /// <param name="title">Заголовок модального окна</param> /// <param name="text_ok_button">Текст конопки Ok (если null or empty), то кнопка не выводится вовсе</param> /// <param name="id_ok_button">ID атрибут конопки Ok</param> /// <param name="text_cansel_button">Текст конопки Cancel (если null or empty), то кнопка не выводится вовсе</param> /// <param name="body_html">Тело модального окна</param> /// <param name="id_modal_dialog">ID атрибут модального окна</param> public static div GetModalDialog(string title, string text_ok_button, string text_cansel_button, base_dom_root body_html, string id_modal_dialog = "exampleModal", string id_ok_button = "button_try_write") { span span_close_modal_header = new span("×"); span_close_modal_header.SetAttribute("aria-hidden", "true"); // button button_close_modal_header = new button(null); button_close_modal_header.AddCSS("close"); button_close_modal_header.SetAttribute("data-dismiss", "modal"); button_close_modal_header.SetAttribute("aria-label", "Close"); button_close_modal_header.AddDomNode(span_close_modal_header); // h5 h5_modal_header = new h5(title); h5_modal_header.AddCSS("modal-title"); div div_modal_header = new div(); div_modal_header.AddCSS("modal-header"); div_modal_header.AddDomNode(h5_modal_header); div_modal_header.AddDomNode(button_close_modal_header); // div modal_footer = new div(); modal_footer.AddCSS("modal-footer"); if (!string.IsNullOrEmpty(text_cansel_button)) { button button_close_modal_footer = GetButton(text_cansel_button, null, null, VisualBootstrapStylesEnum.secondary); button_close_modal_footer.SetAttribute("data-dismiss", "modal"); modal_footer.AddDomNode(button_close_modal_footer); } if (!string.IsNullOrEmpty(text_ok_button)) { button button_send_modal_footer = GetButton(text_ok_button, null, "#", VisualBootstrapStylesEnum.primary); button_send_modal_footer.Id_DOM = id_ok_button; modal_footer.AddDomNode(button_send_modal_footer); } // div modal_content = new div(); modal_content.AddCSS("modal-content"); modal_content.AddDomNode(div_modal_header); // div modal_body = new div(); modal_body.AddCSS("modal-body"); modal_body.AddDomNode(body_html); modal_content.AddDomNode(modal_body); // modal_content.AddDomNode(modal_footer); // div modal_dialog_document = new div(); modal_dialog_document.AddCSS("modal-dialog"); modal_dialog_document.CustomAttributes.Add("role", "document"); modal_dialog_document.AddDomNode(modal_content); // div ModalDialog = new div() { Id_DOM = id_modal_dialog }; ModalDialog.AddCSS("modal fade", true); ModalDialog.CustomAttributes.Add("tabindex", "-1"); ModalDialog.CustomAttributes.Add("role", "dialog"); ModalDialog.CustomAttributes.Add("aria-labelledby", id_modal_dialog); ModalDialog.CustomAttributes.Add("aria-hidden", "true"); ModalDialog.AddDomNode(modal_dialog_document); ModalDialog.before_coment_block = "Modal dialog"; return(ModalDialog); }
public void onMainButtonClick() { buttonPressed(); pressedButton = button.MAIN_BUTTON; }
public void onRestartButtonClick() { buttonPressed(); pressedButton = button.RESTART_BUTTON; }
DoMessage(button, button.Text);
private void BuildMenu(IEnumerable <menu> buttons) { this.menu1.Items.Clear(); foreach (menu customButton in buttons) { MenuItem newMenuItem = new MenuItem { Header = customButton.label }; foreach (var item in customButton.Items) { if (item is button) { button bb = (button)item; MenuItem submenu = new MenuItem { Header = bb.label, Uid = bb.id, Tag = bb.tag }; switch (bb.onAction) { case "SendNormal": case "SendHigh": case "SendLow": submenu.Click += Send; break; case "Guidance": submenu.Click += Guidance; break; case "Launch": submenu.Click += Launch; break; default: submenu.IsEnabled = false; break; } newMenuItem.Items.Add(submenu); } else if (item is menu) { menu m = (menu)item; MenuItem submenu = new MenuItem { Header = m.label }; foreach (var b in m.Items) { if (b is button) { button bb = (button)b; MenuItem subsmenu = new MenuItem { Header = bb.label, Uid = bb.id, Tag = bb.tag }; switch (bb.onAction) { case "SendNormal": case "SendHigh": case "SendLow": subsmenu.Click += Send; break; case "Guidance": subsmenu.Click += Guidance; break; case "Launch": subsmenu.Click += Launch; break; default: subsmenu.IsEnabled = false; break; } submenu.Items.Add(subsmenu); } else if (b is menuSeparator) { submenu.Items.Add(new Separator()); } } newMenuItem.Items.Add(submenu); } else if (item is menuSeparator) { newMenuItem.Items.Add(new Separator()); } } this.menu1.Items.Add(newMenuItem); } }
button.Tag = new ButtonHelper(button);
public wxmenu ConverTowxmenu(wx_menu m) { wxmenu wxmenu = new wxmenu(); List <button> listbtn = new List <button>(); #region 菜单1 if (m.cbxEnable1) { button btn = new button(); if (m.rdotp1 == "0") { btn.name = m.txtbtnName1; btn.type = m.txtbtntp1; switch (btn.type) { case "click": btn.key = m.txtbtnvalue1; break; case "view": btn.url = m.txtbtnvalue1; break; default: break; } } else { btn.name = m.txtmenuName1; List <sub_button> list = new List <sub_button>(); #region 子按钮列表1-5 if (!string.IsNullOrEmpty(m.txtsubbtnName1) && !string.IsNullOrEmpty(m.txtsubbtnvalue1)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName1; sbtn.type = m.txtsubbtntp1; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue1; break; case "view": sbtn.url = m.txtsubbtnvalue1; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName2) && !string.IsNullOrEmpty(m.txtsubbtnvalue2)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName2; sbtn.type = m.txtsubbtntp2; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue2; break; case "view": sbtn.url = m.txtsubbtnvalue2; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName3) && !string.IsNullOrEmpty(m.txtsubbtnvalue3)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName3; sbtn.type = m.txtsubbtntp3; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue3; break; case "view": sbtn.url = m.txtsubbtnvalue3; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName4) && !string.IsNullOrEmpty(m.txtsubbtnvalue4)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName4; sbtn.type = m.txtsubbtntp4; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue4; break; case "view": sbtn.url = m.txtsubbtnvalue4; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName5) && !string.IsNullOrEmpty(m.txtsubbtnvalue5)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName5; sbtn.type = m.txtsubbtntp5; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue5; break; case "view": sbtn.url = m.txtsubbtnvalue5; break; default: break; } list.Add(sbtn); } #endregion btn.sub_button = list.ToArray(); } listbtn.Add(btn); } #endregion #region 菜单2 if (m.cbxEnable2) { button btn = new button(); if (m.rdotp2 == "0") { btn.name = m.txtbtnName2; btn.type = m.txtbtntp2; switch (btn.type) { case "click": btn.key = m.txtbtnvalue2; break; case "view": btn.url = m.txtbtnvalue2; break; default: break; } } else { btn.name = m.txtmenuName2; List <sub_button> list = new List <sub_button>(); #region 子按钮列表6-10 if (!string.IsNullOrEmpty(m.txtsubbtnName6) && !string.IsNullOrEmpty(m.txtsubbtnvalue6)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName6; sbtn.type = m.txtsubbtntp6; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue6; break; case "view": sbtn.url = m.txtsubbtnvalue6; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName7) && !string.IsNullOrEmpty(m.txtsubbtnvalue7)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName7; sbtn.type = m.txtsubbtntp7; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue7; break; case "view": sbtn.url = m.txtsubbtnvalue7; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName8) && !string.IsNullOrEmpty(m.txtsubbtnvalue8)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName8; sbtn.type = m.txtsubbtntp8; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue8; break; case "view": sbtn.url = m.txtsubbtnvalue8; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName9) && !string.IsNullOrEmpty(m.txtsubbtnvalue9)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName9; sbtn.type = m.txtsubbtntp9; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue9; break; case "view": sbtn.url = m.txtsubbtnvalue9; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName10) && !string.IsNullOrEmpty(m.txtsubbtnvalue10)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName10; sbtn.type = m.txtsubbtntp10; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue10; break; case "view": sbtn.url = m.txtsubbtnvalue10; break; default: break; } list.Add(sbtn); } #endregion btn.sub_button = list.ToArray(); } listbtn.Add(btn); } #endregion #region 菜单3 if (m.cbxEnable3) { button btn = new button(); if (m.rdotp3 == "0") { btn.name = m.txtbtnName3; btn.type = m.txtbtntp3; switch (btn.type) { case "click": btn.key = m.txtbtnvalue3; break; case "view": btn.url = m.txtbtnvalue3; break; default: break; } } else { btn.name = m.txtmenuName3; List <sub_button> list = new List <sub_button>(); #region 子按钮列表11-15 if (!string.IsNullOrEmpty(m.txtsubbtnName11) && !string.IsNullOrEmpty(m.txtsubbtnvalue11)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName11; sbtn.type = m.txtsubbtntp11; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue11; break; case "view": sbtn.url = m.txtsubbtnvalue11; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName12) && !string.IsNullOrEmpty(m.txtsubbtnvalue12)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName12; sbtn.type = m.txtsubbtntp12; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue12; break; case "view": sbtn.url = m.txtsubbtnvalue12; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName13) && !string.IsNullOrEmpty(m.txtsubbtnvalue13)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName13; sbtn.type = m.txtsubbtntp13; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue13; break; case "view": sbtn.url = m.txtsubbtnvalue13; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName14) && !string.IsNullOrEmpty(m.txtsubbtnvalue14)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName14; sbtn.type = m.txtsubbtntp14; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue14; break; case "view": sbtn.url = m.txtsubbtnvalue14; break; default: break; } list.Add(sbtn); } if (!string.IsNullOrEmpty(m.txtsubbtnName15) && !string.IsNullOrEmpty(m.txtsubbtnvalue15)) { sub_button sbtn = new sub_button(); sbtn.name = m.txtsubbtnName15; sbtn.type = m.txtsubbtntp15; switch (sbtn.type) { case "click": sbtn.key = m.txtsubbtnvalue15; break; case "view": sbtn.url = m.txtsubbtnvalue15; break; default: break; } list.Add(sbtn); } #endregion btn.sub_button = list.ToArray(); } listbtn.Add(btn); } #endregion wxmenu.menu = new menu(); wxmenu.menu.button = listbtn.ToArray(); return(wxmenu); }
private void Repaint() { canv.Children.Clear(); canv.Children.Add(el1); canv.Children.Add(el2); canv.Children.Add(el3); canv.Children.Add(el4); canv.Children.Add(circChoosen); canv.Children.Add(lineChoosen); circChoosen.Visibility = Visibility.Hidden; lineChoosen.Visibility = Visibility.Hidden; Point p = new Point(0, 0); double w = canv.Width; double h = canv.Height; double xc = p.toX(w); double yc = p.toY(h); int c = 7; Canvas.SetLeft(el1, xc - el1.Width / 2 + c); Canvas.SetTop(el1, yc - el1.Height / 2 + c); Canvas.SetLeft(el2, xc - el2.Width / 2 - c); Canvas.SetTop(el2, yc - el2.Height / 2 - c); Canvas.SetLeft(el3, xc - el3.Width / 2); Canvas.SetTop(el3, yc - el3.Height / 2); Canvas.SetLeft(el4, xc - el4.Width / 2); Canvas.SetTop(el4, yc - el4.Height / 2); lineChoosen.X1 = xc; lineChoosen.Y1 = yc; if (drawH == true) { //make inner circle p = new Point(0, .5); p = p.Rotate(-30 * Math.PI / 180); for (int i = 0; i < 13; i++) { p = p.Rotate(30 * Math.PI / 180); string id = "" + i; button btn = new button(id, p, canv, p.toX(w), p.toY(h)); btn.Click += ButtonClicked; } //make outer circle p = new Point(0, .8); p = p.Rotate(-30 * Math.PI / 180); for (int i = 0; i < 13; i++) { p = p.Rotate(30 * Math.PI / 180); string id = "" + (i + 12); if (i + 12 == 24) { id = "00"; } button btn = new button(id, p, canv, p.toX(w), p.toY(h)); btn.Click += ButtonClicked; } } else { //make outer circle p = new Point(0, .8); p = p.Rotate(-30 * Math.PI / 180); for (int i = 0; i < 13; i++) { p = p.Rotate(30 * Math.PI / 180); string id = "" + (i * 5); if (i * 5 == 60) { id = "00"; } if (i * 5 == 5) { id = "05"; } button btn = new button(id, p, canv, p.toX(w), p.toY(h)); btn.Click += ButtonClicked; } } }