예제 #1
0
파일: BaseMenu.cs 프로젝트: asterick/cstari
 public Menu(DisplayCaption caption, List <MenuItem> entries, MenuCallback callback)
     : base(caption, callback)
 {
     SubMenu     = null;
     menuEntries = entries;
     Clear();
 }
예제 #2
0
        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;
         }
     }
 }
예제 #4
0
        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();
        }
예제 #6
0
파일: Menu.cs 프로젝트: biostar-dev/g-sdk
 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();
        }
예제 #8
0
 private void v_snapshotSoftMakers_CurrentItemChanged(object sender, EventArgs e)
 {
     if (Selected)
     {
         MenuCallback.NavigationStateUpdate();
         MenuCallback.EditingStateUpdate();
     }
 }
예제 #9
0
 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();
 }
예제 #13
0
 private void SoftLicTypesViewport_RowDeleted(object sender, DataRowChangeEventArgs e)
 {
     if (Selected)
     {
         MenuCallback.EditingStateUpdate();
         MenuCallback.NavigationStateUpdate();
         MenuCallback.StatusBarStateUpdate();
     }
 }
예제 #14
0
 public override void ClearSearch()
 {
     _vSoftware.Filter     = StaticFilter;
     dataGridView.RowCount = _vSoftware.Count;
     DynamicFilter         = "";
     MenuCallback.EditingStateUpdate();
     MenuCallback.StatusBarStateUpdate();
     MenuCallback.RelationsStateUpdate();
     MenuCallback.NavigationStateUpdate();
 }
예제 #15
0
 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();
     }
 }
예제 #17
0
 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();
     }
 }
예제 #18
0
 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();
     }
 }
예제 #19
0
        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);
            }
        }
예제 #20
0
        /// <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");
        }
예제 #21
0
        /// <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");
        }
예제 #22
0
 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);
         }
     }
 }
예제 #23
0
파일: CustomMenu.cs 프로젝트: dtbinh/TAFF
        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;
        }
예제 #24
0
        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();
            }
        }
예제 #25
0
 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;
 }
예제 #26
0
 public MENU(string text, MenuCallback proc, IntPtr child, int flags, IntPtr dp)
     : this(text, Marshal.GetFunctionPointerForDelegate(proc), child, flags, dp)
 {
 }
예제 #27
0
 public PopupMenu(DisplayCaption caption, List <MenuItem> entries, MenuCallback callback)
     : base(caption, entries, callback)
 {
     selected = -1;
 }
예제 #28
0
 /**
  * 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;
 }
예제 #29
0
 /**
  * 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;
 }
예제 #30
0
 public MenuItem(string menuText, Menu menu)
 {
     Text          = menuText;
     _menuCallback = menu.Show;
 }
예제 #31
0
 public MenuItem(string menuText, MenuCallback menuCallback)
 {
     Text          = menuText;
     _menuCallback = menuCallback;
 }
예제 #32
0
 public MenuItem(string text, MenuCallback mc)
 {
     MC = mc;
     Text = text;
 }
예제 #33
0
 ///
 ///  @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;
 }
예제 #34
0
 ///
 ///  @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));
 }
예제 #35
0
 public void Add(string text, MenuCallback mc)
 {
     var currentLength = this.menuItems.Count;
     var key = Menuchoices[currentLength];
     this.menuItems.Add(key, new ConsoleMenuItem(text, mc));
 }