Exemple #1
0
        void ToggleMenuBarItem(object sender, EventArgs e)
        {
            MenuBarItem barItem =
                MenuBarItems.FirstOrDefault(x => x.Text == "Added Menu");

            if (barItem == null)
            {
                barItem = new MenuBarItem()
                {
                    Text = "Added Menu"
                };

                barItem.Add(new MenuFlyoutItem()
                {
                    Text    = "Added Flyout Item",
                    Command = new Command(() => ItemClicked(barItem.First(), EventArgs.Empty))
                });

                MenuBarItems.Add(barItem);
            }
            else
            {
                MenuBarItems.Remove(barItem);
            }
        }
Exemple #2
0
        public async Task ShellToolbarWithOnlyMenuBarItemsIsVisible()
        {
            SetupBuilder();

            var shell = await CreateShellAsync((shell) =>
            {
                var contentPage    = new ContentPage();
                var menuFlyoutItem = new MenuFlyoutItem {
                    Text = "Test"
                };
                var menuBarItem = new MenuBarItem {
                    Text = "File"
                };
                menuBarItem.Add(menuFlyoutItem);
                contentPage.MenuBarItems.Add(menuBarItem);

                shell.Items.Add(contentPage);
            });

            await CreateHandlerAndAddToWindow <ShellHandler>(shell, (handler) =>
            {
                Assert.True(IsNavigationBarVisible(handler));

                return(Task.CompletedTask);
            });
        }
Exemple #3
0
        private void CreateMenuBar()
        {
            _MenuBar = new Skill.Editor.UI.MenuBar()
            {
                Dock = Skill.Framework.UI.Dock.Top
            };

            MenuBarItem file = new MenuBarItem()
            {
                Title = "File"
            };
            MenuBarItem edit = new MenuBarItem()
            {
                Title = "Edit"
            };
            MenuBarItem view = new MenuBarItem()
            {
                Title = "View"
            };
            MenuBarItem window = new MenuBarItem()
            {
                Title = "Window", Width = 54
            };

            _ItmSceneMatinee = new UI.MenuItem("Matinees");
            file.Add(_ItmSceneMatinee);

            _MenuBar.Controls.Add(file);
            _MenuBar.Controls.Add(edit);
            _MenuBar.Controls.Add(view);
            _MenuBar.Controls.Add(window);


            Skill.Editor.UI.MenuItem resetLayout = new Skill.Editor.UI.MenuItem("Reset Layout");
            window.Add(resetLayout);
            resetLayout.Click += resetLayout_Click;

            _ItmRollBack = new Skill.Editor.UI.MenuItem("Rollback");
            edit.Add(_ItmRollBack);
            _ItmRollBack.Click += mnuRollback_Click;
        }
Exemple #4
0
        public TreeViewEditor(BehaviorTreeEditorWindow editor)
        {
            this._Editor = editor;
            this.RowDefinitions.Add(20, GridUnitType.Pixel);
            this.RowDefinitions.Add(1, GridUnitType.Star);
            this.ColumnDefinitions.Add(70, GridUnitType.Pixel);
            this.ColumnDefinitions.Add(90, GridUnitType.Pixel);
            this.ColumnDefinitions.Add(1, GridUnitType.Star);

            _TreeView = new Skill.Editor.UI.TreeView()
            {
                Row = 1, Column = 0, ColumnSpan = 4
            };
            _TreeView.DisableFocusable();
            _TreeView.Background.Visibility = Visibility.Visible;
            this.Controls.Add(_TreeView);

            _TreeViewMenuBar = new Skill.Editor.UI.MenuBar()
            {
                Row = 0, Column = 0
            };
            this.Controls.Add(_TreeViewMenuBar);

            #region Add menu
            _AddBehaviorMenuItem = new MenuBarItem();
            _TreeViewMenuBar.Controls.Add(_AddBehaviorMenuItem);

            _AddAction = new Skill.Editor.UI.MenuItem("Action")
            {
                UserData = Skill.Framework.AI.BehaviorType.Action
            };
            _AddAction.Click += AddMenuItem_Click;
            _AddBehaviorMenuItem.Add(_AddAction);

            _AddCondition = new Skill.Editor.UI.MenuItem("Condition")
            {
                UserData = Skill.Framework.AI.BehaviorType.Condition
            };
            _AddCondition.Click += AddMenuItem_Click;
            _AddBehaviorMenuItem.Add(_AddCondition);

            _AddDecorator = new Skill.Editor.UI.MenuItem("Decorator");
            _AddBehaviorMenuItem.Add(_AddDecorator);

            _AddDefaultDecorator = new Skill.Editor.UI.MenuItem("Default")
            {
                Tag = "Decorator", UserData = Skill.Framework.AI.DecoratorType.Default
            };
            _AddDefaultDecorator.Click += AddMenuItem_Click;
            _AddDecorator.Add(_AddDefaultDecorator);

            _AddAccessLimitDecorator = new Skill.Editor.UI.MenuItem("AccessLimit")
            {
                Tag = "Decorator", UserData = Skill.Framework.AI.DecoratorType.AccessLimit
            };
            _AddAccessLimitDecorator.Click += AddMenuItem_Click;
            _AddDecorator.Add(_AddAccessLimitDecorator);

            _AddComposite = new Skill.Editor.UI.MenuItem("Composite");
            _AddBehaviorMenuItem.Add(_AddComposite);

            _AddSequenceComposite = new Skill.Editor.UI.MenuItem("Sequence")
            {
                Tag = "Composite", UserData = Skill.Framework.AI.CompositeType.Sequence
            };
            _AddSequenceComposite.Click += AddMenuItem_Click;
            _AddComposite.Add(_AddSequenceComposite);

            _AddPriorityComposite = new Skill.Editor.UI.MenuItem("Priority")
            {
                Tag = "Composite", UserData = Skill.Framework.AI.CompositeType.Priority
            };
            _AddPriorityComposite.Click += AddMenuItem_Click;
            _AddComposite.Add(_AddPriorityComposite);

            _AddConcurrentComposite = new Skill.Editor.UI.MenuItem("Concurrent")
            {
                Tag = "Composite", UserData = Skill.Framework.AI.CompositeType.Concurrent
            };
            _AddConcurrentComposite.Click += AddMenuItem_Click;
            _AddComposite.Add(_AddConcurrentComposite);

            _AddRandomComposite = new Skill.Editor.UI.MenuItem("Random")
            {
                Tag = "Composite", UserData = Skill.Framework.AI.CompositeType.Random
            };
            _AddRandomComposite.Click += AddMenuItem_Click;
            _AddComposite.Add(_AddRandomComposite);

            _AddLoopComposite = new Skill.Editor.UI.MenuItem("Loop")
            {
                Tag = "Composite", UserData = Skill.Framework.AI.CompositeType.Loop
            };
            _AddLoopComposite.Click += AddMenuItem_Click;
            _AddComposite.Add(_AddLoopComposite);

            #endregion

            #region Insert menu
            _InsertBehaviorMenuItem = new Skill.Editor.UI.MenuBarItem();
            _TreeViewMenuBar.Controls.Add(_InsertBehaviorMenuItem);

            _InsertActions = new Skill.Editor.UI.MenuItem("Actions");
            _InsertBehaviorMenuItem.Add(_InsertActions);

            _InsertConditions = new Skill.Editor.UI.MenuItem("Conditions");
            _InsertBehaviorMenuItem.Add(_InsertConditions);

            _InsertDecorators = new Skill.Editor.UI.MenuItem("Decorators");
            _InsertBehaviorMenuItem.Add(_InsertDecorators);

            _InsertComposites = new Skill.Editor.UI.MenuItem("Composites");
            _InsertBehaviorMenuItem.Add(_InsertComposites);

            _InsertChangeStates = new Skill.Editor.UI.MenuItem("ChangeStates");
            _InsertBehaviorMenuItem.Add(_InsertChangeStates);

            #endregion

            _TreeViewToolbarBg = new Box()
            {
                Row = 0, Column = 2
            };
            this.Controls.Add(_TreeViewToolbarBg);

            _TreeViewToolbar = new StackPanel()
            {
                Row = 0, Column = 1, Orientation = Orientation.Horizontal
            };
            this.Controls.Add(_TreeViewToolbar);


            _BtnRemoveBehavior = new Button()
            {
                Width = 30
            };
            _TreeViewToolbar.Controls.Add(_BtnRemoveBehavior);

            _BtnMoveUp = new Button()
            {
                Width = 30
            };
            _TreeViewToolbar.Controls.Add(_BtnMoveUp);

            _BtnMoveDown = new Button()
            {
                Width = 30
            };
            _TreeViewToolbar.Controls.Add(_BtnMoveDown);

            CheckMenuAvailable();
            _TreeView.SelectedItemChanged += _TreeView_SelectedItemChanged;

            _BtnMoveUp.Click         += _BtnMoveUp_Click;
            _BtnMoveDown.Click       += _BtnMoveDown_Click;
            _BtnRemoveBehavior.Click += _BtnRemoveBehavior_Click;
        }