Exemple #1
0
        // Perform the command associated with MenuIndex on the specified TextBoxBase.
        private void DoTextBoxCommand(TextBoxBase textbox, MenuIndex menuIndex)
        {
            switch (menuIndex)
            {
            case MenuIndex.Undo:            textbox.Undo();                         break;

            case MenuIndex.Redo:
                if (textbox is RichTextBox)
                {
                    RichTextBox rt = (RichTextBox)textbox;
                    rt.Redo();
                }
                break;

            case MenuIndex.Cut:                     textbox.Cut();                          break;

            case MenuIndex.Copy:            textbox.Copy();                         break;

            case MenuIndex.Paste:           textbox.Paste();                        break;

            case MenuIndex.Delete:          textbox.SelectedText = "";      break;

            case MenuIndex.SelectAll:       textbox.SelectAll();            break;

            case MenuIndex.Properties:                                                              break;
            }
        }
Exemple #2
0
        // Click handler for all edit menus.  Determine the focused window
        // and framework control, then call a method to take the appropriate
        // action, based on the type of the control.
        private void Menu_Click(object sender, System.EventArgs e)
        {
            ToolStripMenuItem miClicked = sender as ToolStripMenuItem;

            IntPtr    hFocus    = Win32API.GetFocus();
            Control   ctlFocus  = Win32API.GetFrameworkControl(hFocus);
            MenuIndex menuIndex = (MenuIndex)miClicked.Tag;

            if (ctlFocus is TextBoxBase)
            {
                DoTextBoxCommand((TextBoxBase)ctlFocus, menuIndex);
            }
            else if (ctlFocus is ComboBox && ((ComboBox)ctlFocus).DropDownStyle == ComboBoxStyle.DropDown)
            {
                DoComboBoxCommand(hFocus, (ComboBox)ctlFocus, menuIndex);
            }
            else if (ctlFocus is System.Windows.Forms.DataGridView)
            {
                DoDataGridViewCommand((System.Windows.Forms.DataGridView)ctlFocus, menuIndex);
            }
            else if (ctlFocus is ICSharpCode.TextEditor.TextArea)
            {
                DoICSharpCodeTextEditorCommand(ctlFocus as ICSharpCode.TextEditor.TextArea, menuIndex);
            }
            else
            {
                ISupportsEdit ctlEdit = GetISupportsEditControl(ctlFocus);
                if (ctlEdit != null)
                {
                    DoISupportsEditCommand(ctlEdit, menuIndex);
                }
            }
        }
Exemple #3
0
        // Click handler for all edit menus.  Determine the focused window
        // and framework control, then call a method to take the appropriate
        // action, based on the type of the control.
        private void Menu_Click(object sender, System.EventArgs e)
        {
            MenuItem miClicked = sender as MenuItem;

            IntPtr    hFocus    = Win32API.GetFocus();
            Control   ctlFocus  = Win32API.GetFrameworkControl(hFocus);
            MenuIndex menuIndex = (MenuIndex)miClicked.Index;

            if (ctlFocus is TextBoxBase)
            {
                DoTextBoxCommand((TextBoxBase)ctlFocus, menuIndex);
            }
            else if (ctlFocus is ComboBox && ((ComboBox)ctlFocus).DropDownStyle == ComboBoxStyle.DropDown)
            {
                DoComboBoxCommand(hFocus, (ComboBox)ctlFocus, menuIndex);
            }
            else
            {
                ISupportsEdit ctlEdit = GetISupportsEditControl(ctlFocus);
                if (ctlEdit != null)
                {
                    DoISupportsEditCommand(ctlEdit, menuIndex);
                }
            }
        }
        public PartialVM GetHeader()
        {
            using (var db = new ProjectWebEntities())
            {
                var model = new PartialVM();
                model.AboutUs = db.Tbl_AboutUs.Find(1);
                var menu   = GetMenuTree(1);
                var result = new List <MenuIndex>();
                foreach (var m in menu)
                {
                    var tmp = new MenuIndex();

                    tmp.MenuId     = m.MenuId;
                    tmp.MenuCode   = m.MenuCode;
                    tmp.Menu       = m.Menu;
                    tmp.ProductId  = m.ProductId;
                    tmp.ParentId   = m.ParentId;
                    tmp.NewsId     = m.NewsId;
                    tmp.NewsTypeId = m.NewsTypeId;
                    tmp.Children   = m.Children;
                    tmp.Url        = m.Url;

                    result.Add(tmp);
                }
                model.ListMenuMultiLevels = result;
                return(model);
            }
        }
        /// <summary>
        /// The index page.
        /// </summary>
        /// <returns>A IActionResult.</returns>
        public async Task <IActionResult> Index()
        {
            var response = await HttpClientAsync.Async <IList <MenuModel> >(MenuRoute.Index);

            MenuIndex <MenuModel, MenuPostModel> index = new MenuIndex <MenuModel, MenuPostModel>(response);

            return(this.SearchGridConfiguration(index));
        }
Exemple #6
0
    // Displayed menu
    public void ShowMenu(MenuIndex index)
    {
        currentMenu = index;

        if (index == MenuIndex.ServerList)
        {
            networkManager.RefreshHostList();
        }
    }
Exemple #7
0
        public void NavigateAsync( MenuIndex id )
        {
            Page newPage;

            if ( !Views.ContainsKey( id ) )
            {
                switch ( id )
                {
                    case MenuIndex.Home:

                        Views.Add( id, new ControlNavigationApp( new HomePage(), "#c90019" ) );

                        break;
                    case MenuIndex.Eportes:

                        Views.Add( id, new ControlNavigationApp( new EsporteTabPage(), "#239bd2") );

                        break;
                    case MenuIndex.Plus:

                        Views.Add( id, new ControlNavigationApp( new PlusTabPage(), "#e2007a" ) );

                        break;
                    case MenuIndex.Amazonia:

                        Views.Add( id, new ControlNavigationApp( new AmazonPage(), "#99cc33") );

                        break;
                    case MenuIndex.Sobre:
                        Views.Add( id, new ControlNavigationApp( new HomePage(), "#3333ff") );
                        break;
                    default:
                        break;
                }
            }

            newPage = Views[id];

            if ( newPage == null )
                return;

            ////pop to root for Windows Phone
            //if ( Detail != null && Device.OS == TargetPlatform.WinPhone )
            //{
            //    await Detail.Navigation.PopToRootAsync();
            //}

            Detail = newPage;

            if ( Device.Idiom != TargetIdiom.Tablet )
                IsPresented = false;
        }
    public override void _Ready()
    {
        menu            = Menu.Title;
        menuIndex       = MenuIndex.Play;
        optionMenuIndex = OptionMenuIndex.Resolution;

        prevPos  = Position;
        time     = 0;
        duration = 45;

        sprite     = GetNode <Sprite>("Sprite");
        spriteSize = sprite.Texture.GetSize() * sprite.Scale;
    }
Exemple #9
0
 private void DoDataGridViewCommand(System.Windows.Forms.DataGridView grid, MenuIndex menuIndex)
 {
     switch (menuIndex)
     {
     case MenuIndex.Delete:
         while (grid.SelectedRows.Count > 0)
         {
             DataGridViewRow row = grid.SelectedRows[0];
             grid.Rows.Remove(row);
         }
         break;
     }
 }
Exemple #10
0
        internal MenuStripMenuMute(object menuManager, MenuIndex menuIndex)
        {
            _menuIndex   = menuIndex;
            _menuManager = menuManager as MainFrameBarManager;

            if (menuIndex == null)
            {
                throw new ArgumentNullException("menuIndex");
            }
            if (_menuManager == null)
            {
                throw new ApplicationException("Invalid type of menu manager");
            }

            CreateMenuBar();
        }
Exemple #11
0
        // Perform the command associated with MenuIndex on the specified ComboBox.
        private void DoComboBoxCommand(IntPtr hEdit, ComboBox combobox, MenuIndex menuIndex)
        {
            switch (menuIndex)
            {
            case MenuIndex.Undo:            Win32API.Undo(hEdit); break;

            case MenuIndex.Cut:                     Win32API.Cut(hEdit); break;

            case MenuIndex.Copy:            Win32API.Copy(hEdit); break;

            case MenuIndex.Paste:           Win32API.Paste(hEdit); break;

            case MenuIndex.SelectAll:       combobox.SelectAll(); break;

            case MenuIndex.Delete:          combobox.SelectedText = ""; break;
            }
        }
Exemple #12
0
        // Perform the command associated with MenuIndex on the specified ISupportsEdit control.
        private void DoISupportsEditCommand(ISupportsEdit control, MenuIndex menuIndex)
        {
            switch (menuIndex)
            {
            case MenuIndex.Undo:            control.Undo();                         break;

            case MenuIndex.Redo:            control.Redo();                         break;

            case MenuIndex.Cut:                     control.Cut();                          break;

            case MenuIndex.Copy:            control.Copy();                         break;

            case MenuIndex.Paste:           control.Paste();                        break;

            case MenuIndex.SelectAll:       control.SelectAll();            break;

            case MenuIndex.Delete:          control.Delete();                       break;

            case MenuIndex.Properties:      control.ShowProperties();       break;
            }
        }
        public List <MenuIndex> GetMenuTree(int?parent)
        {
            using (var db = new ProjectWebEntities())
            {
                var query = db.Tbl_MenuMultiLevel.AsEnumerable();
                query = parent == null?query.Where(t => t.ParentId == null).ToList() : query.Where(t => t.ParentId == parent).ToList();

                var result = new List <MenuIndex>();

                foreach (var m in query)
                {
                    var tmp = new MenuIndex();

                    tmp.MenuId   = m.MenuId;
                    tmp.MenuCode = m.MenuCode;
                    tmp.Menu     = m.Menu;
                    tmp.Children = GetMenuTree(m.MenuId);
                    tmp.Url      = m.Url;

                    result.Add(tmp);
                }
                return(result);
            }
        }
Exemple #14
0
 internal MainMenuStripMenu(object menuManager, MenuIndex menuIndex)
     : base(menuManager, menuIndex)
 {
 }
Exemple #15
0
        private void DoICSharpCodeTextEditorCommand(ICSharpCode.TextEditor.TextArea textArea, MenuIndex menuIndex)
        {
            switch (menuIndex)
            {
            case MenuIndex.Undo:
                textArea.Document.UndoStack.Undo();
                break;

            case MenuIndex.Redo:
                textArea.Document.UndoStack.Redo();
                break;

            case MenuIndex.Divider1:
                break;

            case MenuIndex.Cut:
                textArea.ClipboardHandler.Cut(this, EventArgs.Empty);
                break;

            case MenuIndex.Copy:
                textArea.ClipboardHandler.Copy(this, EventArgs.Empty);
                break;

            case MenuIndex.Paste:
                textArea.ClipboardHandler.Paste(this, EventArgs.Empty);
                break;

            case MenuIndex.Divider2:
                break;

            case MenuIndex.Delete:
                textArea.ClipboardHandler.Delete(this, EventArgs.Empty);
                break;

            case MenuIndex.SelectAll:
                textArea.ClipboardHandler.SelectAll(this, EventArgs.Empty);
                break;

            case MenuIndex.Divider3:
                break;

            case MenuIndex.Properties:
                //textArea.Document.
                break;

            default:
                break;
            }
        }
 internal static ToolStripMenuItem Menu(this ToolStripItem[] menuItems, MenuIndex index)
 {
     return menuItems[(int)index] as ToolStripMenuItem;
 }
    public override void _Process(float delta)
    {
        NodePath titleScreenGuiPath  = "/root/TitleScreen/TitleScreenGUI";
        NodePath optionScreenGuiPath = "/root/TitleScreen/OptionScreenGUI";
        var      titleScreenGUI      = GetNode <Control>(titleScreenGuiPath);
        var      optionScreenGUI     = GetNode <Control>(optionScreenGuiPath);

        if (menu == Menu.Title)
        {
            NodePath titleScreenMenuPath = titleScreenGuiPath + "/VBoxContainer/MarginContainer/TitleMenu";
            var      label           = GetNode <Label>(titleScreenMenuPath + "/PlayLabel");
            var      vBoxContainer   = titleScreenGUI.GetNode <VBoxContainer>("VBoxContainer");
            var      marginContainer = titleScreenGUI.GetNode <MarginContainer>("VBoxContainer/MarginContainer");

            if (Input.IsActionJustPressed("ui_left"))
            {
                if (menuIndex == MenuIndex.Play)
                {
                    menuIndex = MenuIndex.Quit;
                }
                else
                {
                    menuIndex--;
                }

                ResetTween();
            }

            if (Input.IsActionJustPressed("ui_right"))
            {
                if (menuIndex == MenuIndex.Quit)
                {
                    menuIndex = MenuIndex.Play;
                }
                else
                {
                    menuIndex++;
                }

                ResetTween();
            }

            if (Input.IsActionJustPressed("ui_accept"))
            {
                switch (menuIndex)
                {
                case MenuIndex.Play:
                    GetTree().ChangeScene("res://Scenes/Rooms/Room1v1.tscn");
                    break;

                case MenuIndex.Options:
                    ResetTween();
                    menu = Menu.Option;
                    optionScreenGUI.Visible = true;
                    titleScreenGUI.Visible  = false;
                    break;

                case MenuIndex.Quit:
                    GetTree().Quit();
                    break;
                }
            }

            switch (menuIndex)
            {
            case MenuIndex.Play:
                label = GetNode <Label>(titleScreenMenuPath + "/PlayLabel");
                break;

            case MenuIndex.Options:
                label = GetNode <Label>(titleScreenMenuPath + "/OptionsLabel");
                break;

            case MenuIndex.Quit:
                label = GetNode <Label>(titleScreenMenuPath + "/QuitLabel");
                break;
            }

            float x        = vBoxContainer.RectPosition.x + label.MarginRight - label.RectSize.x / 2;
            float y        = vBoxContainer.RectPosition.y + marginContainer.RectPosition.y + label.RectSize.y / 2;
            var   labelPos = new Vector2(x, y);

            AnimateTween(prevPos, labelPos);
        }
        else
        {
            NodePath optionScreenMenuPath = optionScreenGuiPath + "/MarginContainer/VBoxContainer/OptionMenu";
            var      label           = GetNode <Label>(optionScreenMenuPath + "/ResolutionValue");
            var      marginContainer = optionScreenGUI.GetNode <MarginContainer>("MarginContainer");
            var      gridContainer   = optionScreenGUI.GetNode <GridContainer>("MarginContainer/VBoxContainer/OptionMenu");

            if (Input.IsActionJustPressed("ui_cancel"))
            {
                ResetTween();

                menu = Menu.Title;
                titleScreenGUI.Visible  = true;
                optionScreenGUI.Visible = false;
            }

            if (Input.IsActionJustPressed("ui_up"))
            {
                if (optionMenuIndex == OptionMenuIndex.Resolution)
                {
                    optionMenuIndex = OptionMenuIndex.Vsync;
                }
                else
                {
                    optionMenuIndex--;
                }

                ResetTween();
            }

            if (Input.IsActionJustPressed("ui_down"))
            {
                if (optionMenuIndex == OptionMenuIndex.Vsync)
                {
                    optionMenuIndex = OptionMenuIndex.Resolution;
                }
                else
                {
                    optionMenuIndex++;
                }

                ResetTween();
            }

            switch (optionMenuIndex)
            {
            case OptionMenuIndex.Resolution:
                label = GetNode <Label>(optionScreenMenuPath + "/ResolutionValue");
                break;

            case OptionMenuIndex.Fullscreen:
                label = GetNode <Label>(optionScreenMenuPath + "/FullscreenValue");
                break;

            case OptionMenuIndex.Vsync:
                label = GetNode <Label>(optionScreenMenuPath + "/VsyncValue");
                break;
            }

            float x        = marginContainer.MarginLeft + label.MarginRight - spriteSize.x / 2 + 16;
            float y        = marginContainer.RectPosition.y + gridContainer.RectPosition.y + label.RectPosition.y + label.RectSize.y / 2;
            var   labelPos = new Vector2(x, y);

            AnimateTween(prevPos, labelPos);
        }
    }
Exemple #18
0
 void Start()
 {
     currentMenu = MenuIndex.MainMenu;
 }