public Menu(DisplayCaption caption, List <MenuItem> entries, MenuCallback callback) : base(caption, callback) { SubMenu = null; menuEntries = entries; Clear(); }
private void InstallatorsViewport_RowChanged(object sender, DataRowChangeEventArgs e) { if (!_syncViews) { return; } var rowIndex = _vSnapshotInstallators.Find("ID Installator", e.Row["ID Installator"]); if (rowIndex == -1 && _vInstallators.Find("ID Installator", e.Row["ID Installator"]) != -1) { _snapshotInstallators.Rows.Add(e.Row["ID Installator"], e.Row["FullName"], e.Row["Profession"], e.Row["Inactive"]); } else if (rowIndex != -1) { var row = (DataRowView)_vSnapshotInstallators[rowIndex]; row["FullName"] = e.Row["FullName"]; row["Profession"] = e.Row["Profession"]; row["Inactive"] = e.Row["Inactive"]; } if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); MenuCallback.EditingStateUpdate(); } }
private void CheckViewportModifications() { if (!_isEditable) { return; } if (!ContainsFocus || dataGridView.Focused) { return; } if ((_vSoftware.Position != -1) && (SoftwareFromView() != SoftwareFromViewport())) { if (_viewportState == ViewportState.ReadState) { _viewportState = ViewportState.ModifyRowState; MenuCallback.EditingStateUpdate(); dataGridView.Enabled = false; } } else { if (_viewportState == ViewportState.ModifyRowState) { _viewportState = ViewportState.ReadState; MenuCallback.EditingStateUpdate(); dataGridView.Enabled = true; } } }
private void SoftLicTypesViewport_RowChanged(object sender, DataRowChangeEventArgs e) { if (!_syncViews) { return; } var rowIndex = _vSnapshotSoftLicTypes.Find("ID LicType", e.Row["ID LicType"]); if (rowIndex == -1 && _vSoftLicTypes.Find("ID LicType", e.Row["ID LicType"]) != -1) { _snapshotSoftLicTypes.Rows.Add(e.Row["ID LicType"], e.Row["LicType"], e.Row["LicKeyDuplicateAllowed"]); } else if (rowIndex != -1) { var row = ((DataRowView)_vSnapshotSoftLicTypes[rowIndex]); row["LicType"] = e.Row["LicType"]; row["LicKeyDuplicateAllowed"] = e.Row["LicKeyDuplicateAllowed"]; } if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); MenuCallback.EditingStateUpdate(); } }
private void SoftLicKeysViewport_RowChanged(object sender, DataRowChangeEventArgs e) { if (!_syncViews) { return; } var rowIndex = _vSnapshotSoftVersions.Find("ID Version", e.Row["ID Version"]); if (rowIndex == -1 && _vSoftVersions.Find("ID Version", e.Row["ID Version"]) != -1) { _snapshotSoftVersions.Rows.Add(e.Row["ID Version"], e.Row["ID Software"], e.Row["Version"]); } else if (rowIndex != -1) { var row = ((DataRowView)_vSnapshotSoftVersions[rowIndex]); row["ID Software"] = e.Row["ID Software"]; row["Version"] = e.Row["Version"]; } if (!Selected) { return; } MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); MenuCallback.EditingStateUpdate(); MenuCallback.RelationsStateUpdate(); }
public MenuItem(string menuKey, string menuText, MenuCallback menuCallback, bool menuExit) { key = menuKey; text = menuText; callback = menuCallback; exit = menuExit; }
public override void CancelRecord() { switch (_viewportState) { case ViewportState.ReadState: return; case ViewportState.NewRowState: _softwareDm.EditingNewRecord = false; if (_vSoftware.Position != -1) { _isEditable = false; dataGridView.Enabled = true; ((DataRowView)_vSoftware[_vSoftware.Position]).Delete(); dataGridView.RowCount = dataGridView.RowCount - 1; if (_vSoftware.Position != -1) { dataGridView.Rows[_vSoftware.Position].Selected = true; } } _viewportState = ViewportState.ReadState; break; case ViewportState.ModifyRowState: dataGridView.Enabled = true; _isEditable = false; DataBind(); _viewportState = ViewportState.ReadState; break; } _isEditable = true; MenuCallback.EditingStateUpdate(); SetViewportCaption(); }
private void v_snapshotSoftMakers_CurrentItemChanged(object sender, EventArgs e) { if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.EditingStateUpdate(); } }
protected override void OnClosing(System.ComponentModel.CancelEventArgs e) { if (e.Cancel != true) { MenuCallback.SwitchToPreviousViewport(); } base.OnClosing(e); }
private void VSnapshotVersionsCurrentItemChanged(object sender, EventArgs e) { if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.EditingStateUpdate(); MenuCallback.RelationsStateUpdate(); } }
public override void CancelRecord() { _snapshotSoftVersions.Clear(); for (var i = 0; i < _vSoftVersions.Count; i++) { _snapshotSoftVersions.Rows.Add(DataRowViewToArray(((DataRowView)_vSoftVersions[i]))); } MenuCallback.EditingStateUpdate(); }
private void v_snapshotSoftTypes_CurrentItemChanged(object sender, EventArgs e) { if (!Selected) { return; } MenuCallback.NavigationStateUpdate(); MenuCallback.EditingStateUpdate(); }
private void SoftLicTypesViewport_RowDeleted(object sender, DataRowChangeEventArgs e) { if (Selected) { MenuCallback.EditingStateUpdate(); MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); } }
public override void ClearSearch() { _vSoftware.Filter = StaticFilter; dataGridView.RowCount = _vSoftware.Count; DynamicFilter = ""; MenuCallback.EditingStateUpdate(); MenuCallback.StatusBarStateUpdate(); MenuCallback.RelationsStateUpdate(); MenuCallback.NavigationStateUpdate(); }
private void SoftMakersViewport_RowDeleted(object sender, DataRowChangeEventArgs e) { if (!Selected) { return; } MenuCallback.EditingStateUpdate(); MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); }
private void SoftLicKeysViewport_RowDeleted(object sender, DataRowChangeEventArgs e) { MenuCallback.ForceCloseDetachedViewports(); if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.StatusBarStateUpdate(); MenuCallback.EditingStateUpdate(); MenuCallback.RelationsStateUpdate(); } }
private void SoftwareViewport_RowChanged(object sender, DataRowChangeEventArgs e) { if (e.Action == DataRowAction.Change || e.Action == DataRowAction.ChangeCurrentAndOriginal || e.Action == DataRowAction.ChangeOriginal) { dataGridView.Refresh(); } dataGridView.RowCount = _vSoftware.Count; if (Selected) { MenuCallback.StatusBarStateUpdate(); } }
private void SoftwareViewport_RowDeleted(object sender, DataRowChangeEventArgs e) { if (e.Action != DataRowAction.Delete) { return; } dataGridView.RowCount = _vSoftware.Count; dataGridView.Refresh(); MenuCallback.ForceCloseDetachedViewports(); if (Selected) { MenuCallback.StatusBarStateUpdate(); } }
public void SetupMenu(string title, List <string> items, MenuCallback callback) { m_title = title; m_menu_index = 0; m_callback = callback; m_active = false; m_menu_choices = new MenuItem[items.Count]; int index = 0; foreach (string str in items) { m_menu_choices[index++] = new MenuItem(str); } }
/// <summary> /// /// </summary> /// <param name="strItems">Array of menu items. Must be 4 strings per menu item: 1) menu ID, /// 2) caption, 3) action</param> public clsLCDMenu(string[] strItems, ILCD lcd, InterruptPort buttonUp, InterruptPort buttonDown, MenuCallback getCaption, MenuGetValue getValue, MenuSetValue setValue) { int intNumItems = strItems.Length; if (intNumItems % 3 != 00) { throw new ApplicationException("Invalid menu array - size must be multiple of 4"); } int intMenuIndex = 0; // index of item within its menu (0-based) for (int i = 0; i < intNumItems; i = i + 3) { int intNextMenu = -1; int intPrevMenu = -1; if (i >= 3 && strItems[i] == strItems[i - 3]) { // this isn't the first item in this menu - point to the previous item intPrevMenu = intMenuIndex - 1; } if ((i + 3) < intNumItems && strItems[i] == strItems[i + 3]) { // this isn't the last item in this menu - point to the next item intNextMenu = intMenuIndex + 1; } lstMenu.Add(new menuItem((byte)(i + 1), strItems[i], strItems[i + 1], intNextMenu, intPrevMenu, strItems[i + 2])); intMenuIndex += 1; } intMenuCount = lstMenu.Count; this.lcd = lcd; this.buttonUp = buttonUp; this.buttonDown = buttonDown; this.buttonUp.OnInterrupt += new NativeEventHandler(buttonUp_OnInterrupt); this.buttonDown.OnInterrupt += new NativeEventHandler(buttonDown_OnInterrupt); lcd.SetCursorOn(true); // set block cursor this.menuGetCaption = getCaption; this.menuGetValue = getValue; this.menuSetValue = setValue; // display menu 1 - the Main Menu displayMenu("1"); }
/// <summary> /// /// </summary> /// <param name="strItems">Array of menu items. Must be 4 strings per menu item: 1) menu ID, /// 2) caption, 3) action</param> public clsLCDMenu(string[] strItems, ILCD lcd, InterruptPort buttonUp, InterruptPort buttonDown, MenuCallback getCaption, MenuGetValue getValue, MenuSetValue setValue) { int intNumItems = strItems.Length; if (intNumItems % 3 != 00) { throw new ApplicationException("Invalid menu array - size must be multiple of 4"); } int intMenuIndex = 0; // index of item within its menu (0-based) for (int i = 0; i < intNumItems; i = i + 3) { int intNextMenu = -1; int intPrevMenu = -1; if (i >= 3 && strItems[i] == strItems[i - 3]) { // this isn't the first item in this menu - point to the previous item intPrevMenu = intMenuIndex - 1; } if ((i + 3) < intNumItems && strItems[i] == strItems[i + 3]) { // this isn't the last item in this menu - point to the next item intNextMenu = intMenuIndex + 1; } lstMenu.Add(new menuItem((byte)(i + 1), strItems[i], strItems[i+1], intNextMenu, intPrevMenu, strItems[i+2])); intMenuIndex += 1; } intMenuCount = lstMenu.Count; this.lcd = lcd; this.buttonUp = buttonUp; this.buttonDown = buttonDown; this.buttonUp.OnInterrupt +=new NativeEventHandler(buttonUp_OnInterrupt); this.buttonDown.OnInterrupt +=new NativeEventHandler(buttonDown_OnInterrupt); lcd.SetCursorOn(true); // set block cursor this.menuGetCaption = getCaption; this.menuGetValue = getValue; this.menuSetValue = setValue; // display menu 1 - the Main Menu displayMenu("1"); }
public override void DeleteRecord() { if (MessageBox.Show(@"Вы действительно хотите удалить эту запись?", @"Внимание", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { if (SoftwareDataModel.Delete((int)((DataRowView)_vSoftware.Current)["ID Software"]) == -1) { return; } _isEditable = false; ((DataRowView)_vSoftware[_vSoftware.Position]).Delete(); _isEditable = true; _viewportState = ViewportState.ReadState; MenuCallback.EditingStateUpdate(); MenuCallback.ForceCloseDetachedViewports(); if (CalcDataModelSoftwareConcat.HasInstance()) { CalcDataModelSoftwareConcat.GetInstance().Refresh(EntityType.Software, (int)((DataRowView)_vSoftware.Current)["ID Software"], true); } } }
public void Call(MenuCallback menuCallback, params string[] items) { buttonRects.Clear(); buttonCaptions.Clear(); if (NodeEditorWindow.coreSystem == null) { return; } rect = new Rect(Event.current.mousePosition * 1f, new Vector2(150f, buttonHeight * items.Length)); // Configure Buttons for (int i = 0; i < items.Length; i++) { buttonRects.Add(new Rect(rect.x, rect.y + (buttonHeight * i), rect.width, buttonHeight)); buttonCaptions.Add(items [i]); } callbackReference = menuCallback; // EditorWindow needs to trigger OnGUI also on mouseMove while ContextMenu is open - for hover effect NodeEditorWindow.self.wantsMouseMove = true; visible = true; }
public void Show() { for (int i = 0; i < m_Items.Count; ++i) { MenuItem mi = m_Items[i] as MenuItem; Console.WriteLine(" [{0}] {1}", i + 1, mi.text); } Console.Write("Selection: "); int choosen = Int32.Parse(Console.ReadLine()); if (choosen > m_Items.Count || choosen < 1) { Console.WriteLine("Invalid option."); } else { MenuItem mi = m_Items[choosen - 1] as MenuItem; MenuCallback mc = mi.mc; mc(); } }
private void v_software_CurrentItemChanged(object sender, EventArgs e) { SetViewportCaption(); if (_vSoftware.Position == -1 || dataGridView.RowCount == 0) { dataGridView.ClearSelection(); } else if (_vSoftware.Position >= dataGridView.RowCount) { dataGridView.Rows[dataGridView.RowCount - 1].Selected = true; dataGridView.CurrentCell = dataGridView.Rows[dataGridView.RowCount - 1].Cells[1]; } else if (dataGridView.Rows[_vSoftware.Position].Selected != true) { dataGridView.Rows[_vSoftware.Position].Selected = true; dataGridView.CurrentCell = dataGridView.Rows[_vSoftware.Position].Cells[1]; } if (Selected) { MenuCallback.NavigationStateUpdate(); MenuCallback.EditingStateUpdate(); MenuCallback.RelationsStateUpdate(); } if (_vSoftware.Position == -1) { return; } if (_viewportState == ViewportState.NewRowState) { return; } dataGridView.Enabled = true; _viewportState = ViewportState.ReadState; _isEditable = true; }
public MENU(string text, MenuCallback proc, IntPtr child, int flags, IntPtr dp) : this(text, Marshal.GetFunctionPointerForDelegate(proc), child, flags, dp) { }
public PopupMenu(DisplayCaption caption, List <MenuItem> entries, MenuCallback callback) : base(caption, entries, callback) { selected = -1; }
/** * Constructor(string, Menu) * Creates a menu item with text and another menu to display. */ public MenuItem(string text, Menu menu) { menuText = menu.menuTitle; menuCallback = menu.Show; }
/** * Constructor(string, MenuCallback) * Creates a menu item with text and a method as a callback. */ public MenuItem(string text, MenuCallback callback) { menuText = text; menuCallback = callback; }
public MenuItem(string menuText, Menu menu) { Text = menuText; _menuCallback = menu.Show; }
public MenuItem(string menuText, MenuCallback menuCallback) { Text = menuText; _menuCallback = menuCallback; }
public MenuItem(string text, MenuCallback mc) { MC = mc; Text = text; }
/// /// @brief The Menu class constructor. /// /// @param Text The text string to be displayed in the menu. /// @param Mc The delegate pointer to the menu event handler. /// public MenuItem(string Text, MenuCallback Mc) { mc = Mc; text = Text; }
/// /// @brief Add a menu item to the list. /// /// @param Text The text string to be displayed in the menu. /// @param Mc The delegate pointer to the menu event handler. /// public void Add(string text, MenuCallback mc) { m_Items.Add(new MenuItem(text, mc)); }
public void Add(string text, MenuCallback mc) { var currentLength = this.menuItems.Count; var key = Menuchoices[currentLength]; this.menuItems.Add(key, new ConsoleMenuItem(text, mc)); }