private void OnListBoxClick(object sender, PointerEventArgs e)
        {
            if (e.Data.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo createFolder = new MenuItemInfo {
                    Path = "Create/Folder"
                };
                createFolder.Action  = new MenuItemEvent();
                createFolder.Command = "CurrentFolder";
                createFolder.Action.AddListener(CreateFolder);
                menuItems.Add(createFolder);

                if (m_project.ToGuid(typeof(Material)) != Guid.Empty)
                {
                    MenuItemInfo createMaterial = new MenuItemInfo {
                        Path = "Create/Material"
                    };
                    createMaterial.Action  = new MenuItemEvent();
                    createMaterial.Command = "CurrentFolder";
                    createMaterial.Action.AddListener(CreateMaterial);
                    menuItems.Add(createMaterial);
                }

                menu.Open(menuItems.ToArray());
            }
        }
Esempio n. 2
0
        private void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                MenuItemInfo createFolder = new MenuItemInfo {
                    Path = "Create Folder"
                };
                createFolder.Action = new MenuItemEvent();
                createFolder.Action.AddListener(CreateFolder);

                MenuItemInfo deleteFolder = new MenuItemInfo {
                    Path = "Delete"
                };
                deleteFolder.Action = new MenuItemEvent();
                deleteFolder.Action.AddListener(DeleteFolder);

                MenuItemInfo renameFolder = new MenuItemInfo {
                    Path = "Rename"
                };
                renameFolder.Action = new MenuItemEvent();
                renameFolder.Action.AddListener(RenameFolder);

                menu.Open(new[]
                {
                    createFolder,
                    deleteFolder,
                    renameFolder
                });
            }
        }
        private void OnListBoxClick(object sender, PointerEventArgs e)
        {
            if (e.Data.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo createFolder = new MenuItemInfo
                {
                    Path = string.Format("{0}/{1}",
                                         m_localization.GetString("ID_RTEditor_ProjectFolderView_Create", "Create"),
                                         m_localization.GetString("ID_RTEditor_ProjectFolderView_Folder", "Folder"))
                };
                createFolder.Action  = new MenuItemEvent();
                createFolder.Command = "CurrentFolder";
                createFolder.Action.AddListener(CreateFolder);
                menuItems.Add(createFolder);

                string materialStr      = m_localization.GetString("ID_RTEditor_ProjectFolderView_Material", "Material");
                string animationClipStr = m_localization.GetString("ID_RTEditor_ProjectFolderView_AnimationClip", "Animation Clip");
                CreateMenuItem(materialStr, materialStr, typeof(Material), menuItems);
                CreateMenuItem(animationClipStr, animationClipStr.Replace(" ", ""), typeof(RuntimeAnimationClip), menuItems);

                if (ContextMenu != null)
                {
                    ContextMenu(this, new ProjectTreeContextMenuEventArgs(m_folders.Take(1).ToArray(), menuItems));
                }

                menu.Open(menuItems.ToArray());
            }
        }
Esempio n. 4
0
        private void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu        menu      = IOC.Resolve <IContextMenu>();
                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo createFolder = new MenuItemInfo {
                    Path = "Create/Folder"
                };
                createFolder.Action = new MenuItemEvent();
                createFolder.Action.AddListener(CreateFolder);
                createFolder.Validate = new MenuItemValidationEvent();
                createFolder.Validate.AddListener(CreateValidate);
                menuItems.Add(createFolder);

                CreateMenuItem("Material", "Material", typeof(Material), menuItems);
                CreateMenuItem("Animation Clip", "AnimationClip", typeof(RuntimeAnimationClip), menuItems);

                MenuItemInfo open = new MenuItemInfo {
                    Path = "Open"
                };
                open.Action = new MenuItemEvent();
                open.Action.AddListener(Open);
                open.Validate = new MenuItemValidationEvent();
                open.Validate.AddListener(OpenValidate);
                menuItems.Add(open);

                MenuItemInfo duplicate = new MenuItemInfo {
                    Path = "Duplicate"
                };
                duplicate.Action = new MenuItemEvent();
                duplicate.Action.AddListener(Duplicate);
                duplicate.Validate = new MenuItemValidationEvent();
                duplicate.Validate.AddListener(DuplicateValidate);
                menuItems.Add(duplicate);


                MenuItemInfo deleteFolder = new MenuItemInfo {
                    Path = "Delete"
                };
                deleteFolder.Action = new MenuItemEvent();
                deleteFolder.Action.AddListener(Delete);
                menuItems.Add(deleteFolder);

                MenuItemInfo renameFolder = new MenuItemInfo {
                    Path = "Rename"
                };
                renameFolder.Action = new MenuItemEvent();
                renameFolder.Action.AddListener(Rename);
                menuItems.Add(renameFolder);

                menu.Open(menuItems.ToArray());
            }
        }
        protected virtual void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu        menu      = IOC.Resolve <IContextMenu>();
                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                OnContextMenu(menuItems);

                menu.Open(menuItems.ToArray());
            }
        }
Esempio n. 6
0
        private void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu        menu      = IOC.Resolve <IContextMenu>();
                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                OnContextMenu(menuItems);

                if (ContextMenu != null)
                {
                    ContextMenu(this, new ProjectTreeContextMenuEventArgs(e.Items.OfType <ProjectItem>().ToArray(), menuItems));
                }

                menu.Open(menuItems.ToArray());
            }
        }
        protected override void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();
                MenuItemInfo        command   = new MenuItemInfo {
                    Path = "Run/Cmd"
                };
                command.Action  = new MenuItemEvent();
                command.Command = "Do Something";
                command.Action.AddListener(DoSomething);
                menuItems.Add(command);

                menu.Open(menuItems.ToArray());
            }
        }
Esempio n. 8
0
        private void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                MenuItemInfo createFolder = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectTreeView_CreateFolder", "Create Folder")
                };
                createFolder.Action = new MenuItemEvent();
                createFolder.Action.AddListener(CreateFolder);

                MenuItemInfo deleteFolder = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectTreeView_Delete", "Delete")
                };
                deleteFolder.Action = new MenuItemEvent();
                deleteFolder.Action.AddListener(DeleteFolder);

                MenuItemInfo renameFolder = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectTreeView_Rename", "Rename")
                };
                renameFolder.Action = new MenuItemEvent();
                renameFolder.Action.AddListener(RenameFolder);

                List <MenuItemInfo> menuItems = new List <MenuItemInfo>
                {
                    createFolder,
                    deleteFolder,
                    renameFolder
                };

                if (ContextMenu != null)
                {
                    ProjectTreeContextMenuEventArgs args = new ProjectTreeContextMenuEventArgs(e.Items.OfType <ProjectItem>().ToArray(), menuItems);
                    ContextMenu(this, args);
                }

                if (menuItems.Count > 0)
                {
                    menu.Open(menuItems.ToArray());
                }
            }
        }
Esempio n. 9
0
        private void OnListBoxClick(object sender, PointerEventArgs e)
        {
            if (e.Data.button == PointerEventData.InputButton.Right)
            {
                IContextMenu menu = IOC.Resolve <IContextMenu>();

                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo createFolder = new MenuItemInfo {
                    Path = "Create/Folder"
                };
                createFolder.Action  = new MenuItemEvent();
                createFolder.Command = "CurrentFolder";
                createFolder.Action.AddListener(CreateFolder);
                menuItems.Add(createFolder);

                CreateMenuItem("Material", "Material", typeof(Material), menuItems);
                CreateMenuItem("Animation Clip", "AnimationClip", typeof(RuntimeAnimationClip), menuItems);

                menu.Open(menuItems.ToArray());
            }
        }
        protected virtual void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu        menu      = IOC.Resolve <IContextMenu>();
                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo duplicate = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_HierarchyViewImpl_Duplicate", "Duplicate")
                };
                duplicate.Action = new MenuItemEvent();
                duplicate.Action.AddListener(DuplicateContextMenuCmd);
                duplicate.Validate = new MenuItemValidationEvent();
                duplicate.Validate.AddListener(DuplicateValidateContextMenuCmd);
                menuItems.Add(duplicate);

                MenuItemInfo delete = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_HierarchyViewImpl_Delete", "Delete")
                };
                delete.Action = new MenuItemEvent();
                delete.Action.AddListener(DeleteContextMenuCmd);
                delete.Validate = new MenuItemValidationEvent();
                delete.Validate.AddListener(DeleteValidateContextMenuCmd);
                menuItems.Add(delete);

                MenuItemInfo rename = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_HierarchyViewImpl_Rename", "Rename")
                };
                rename.Action = new MenuItemEvent();
                rename.Action.AddListener(RenameContextMenuCmd);
                rename.Validate = new MenuItemValidationEvent();
                rename.Validate.AddListener(RenameValidateContextMenuCmd);
                menuItems.Add(rename);

                menu.Open(menuItems.ToArray());
            }
        }
        private void OnItemClick(object sender, ItemArgs e)
        {
            if (e.PointerEventData.button == PointerEventData.InputButton.Right)
            {
                IContextMenu        menu      = IOC.Resolve <IContextMenu>();
                List <MenuItemInfo> menuItems = new List <MenuItemInfo>();

                MenuItemInfo createFolder = new MenuItemInfo
                {
                    Path = string.Format("{0}/{1}",
                                         m_localization.GetString("ID_RTEditor_ProjectFolderView_Create", "Create"),
                                         m_localization.GetString("ID_RTEditor_ProjectFolderView_Folder", "Folder"))
                };
                createFolder.Action = new MenuItemEvent();
                createFolder.Action.AddListener(CreateFolder);
                createFolder.Validate = new MenuItemValidationEvent();
                createFolder.Validate.AddListener(CreateValidate);
                menuItems.Add(createFolder);

                string materialStr      = m_localization.GetString("ID_RTEditor_ProjectFolderView_Material", "Material");
                string animationClipStr = m_localization.GetString("ID_RTEditor_ProjectFolderView_AnimationClip", "Animation Clip");
                CreateMenuItem(materialStr, materialStr, typeof(Material), menuItems);
                CreateMenuItem(animationClipStr, animationClipStr.Replace(" ", ""), typeof(RuntimeAnimationClip), menuItems);

                MenuItemInfo open = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectFolderView_Open", "Open")
                };
                open.Action = new MenuItemEvent();
                open.Action.AddListener(Open);
                open.Validate = new MenuItemValidationEvent();
                open.Validate.AddListener(OpenValidate);
                menuItems.Add(open);

                MenuItemInfo duplicate = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectFolderView_Duplicate", "Duplicate")
                };
                duplicate.Action = new MenuItemEvent();
                duplicate.Action.AddListener(Duplicate);
                duplicate.Validate = new MenuItemValidationEvent();
                duplicate.Validate.AddListener(DuplicateValidate);
                menuItems.Add(duplicate);

                MenuItemInfo deleteFolder = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectFolderView_Delete", "Delete")
                };
                deleteFolder.Action = new MenuItemEvent();
                deleteFolder.Action.AddListener(Delete);
                menuItems.Add(deleteFolder);

                MenuItemInfo renameFolder = new MenuItemInfo {
                    Path = m_localization.GetString("ID_RTEditor_ProjectFolderView_Rename", "Rename")
                };
                renameFolder.Action = new MenuItemEvent();
                renameFolder.Action.AddListener(Rename);
                menuItems.Add(renameFolder);

                if (ContextMenu != null)
                {
                    ContextMenu(this, new ProjectTreeContextMenuEventArgs(e.Items.OfType <ProjectItem>().ToArray(), menuItems));
                }

                menu.Open(menuItems.ToArray());
            }
        }