public PhotoVersionMenu (Photo photo)
	{
		version_id = photo.DefaultVersionId;

		uint [] version_ids = photo.VersionIds;
		item_infos = new MenuItemInfo [version_ids.Length];

		int i = 0;
		foreach (uint id in version_ids) {
			MenuItem menu_item = new MenuItem (photo.GetVersionName (id));
			menu_item.Show ();
			menu_item.Sensitive = true;
			menu_item.Activated += new EventHandler (HandleMenuItemActivated);

			item_infos [i ++] = new MenuItemInfo (menu_item, id);

			Append (menu_item);
		}

		if (version_ids.Length == 1) {
			MenuItem no_edits_menu_item = new MenuItem (Mono.Unix.Catalog.GetString ("(No Edits)"));
			no_edits_menu_item.Show ();
			no_edits_menu_item.Sensitive = false;
			Append (no_edits_menu_item);
		}
	}
        public virtual void Tweak(CentrifugeMenu menu)
        {
            //GameObject item = menu.OptionsTable.transform.Find(Name).gameObject;
            GameObject[] items = (from x in menu.OptionsTable.GetChildren() where string.Equals(x.name, Name) select x).ToArray();

            GameObject item = null;

            if (items.Length > 0)
            {
                item = items[0];
            }

            if (item != null)
            {
                MenuItemInfo info = item.AddComponent <MenuItemInfo>();
                info.Item = this;
            }
        }
Example #3
0
        Button AddMenuItem(MenuItemInfo menuItem)
        {
            ImageSource imageSource = null;

            if (!string.IsNullOrWhiteSpace(menuItem.IconPath))
            {
                imageSource = SystemIcon.GetImageSource($"{AppDomain.CurrentDomain.BaseDirectory}Images/{menuItem.IconPath}");
            }
            else if (System.IO.File.Exists(menuItem.FilePath))
            {
                imageSource = SystemIcon.GetImageSource(true, menuItem.FilePath);
            }

            StackPanel sp = new StackPanel();

            sp.Orientation = Orientation.Vertical;
            Image img = new Image
            {
                Source = imageSource,
                Width  = 36,
                Height = 36,
                Tag    = menuItem
            };

            sp.Children.Add(img);

            TextBlock tb = new TextBlock
            {
                Text = menuItem.Name,
                HorizontalAlignment = HorizontalAlignment.Center
            };

            sp.Children.Add(tb);

            var btn = new Button()
            {
                ToolTip = menuItem.Name,
                Content = sp
            };

            btn.Click += (s, e) => RunExe(menuItem);

            return(btn);
        }
Example #4
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());
                }
            }
        }
Example #5
0
        /// <summary>
        /// Adds the item.
        /// </summary>
        /// <param name="customMenuHandler">The custom menu handler.</param>
        /// <param name="helpText">The help.</param>
        /// <param name="contextCommand">The context command.</param>
        public void AddItem(CustomMenuHandler customMenuHandler, string helpText, ContextCommand contextCommand)
        {
            if (customMenuHandler == null)
            {
                throw new ArgumentNullException(nameof(customMenuHandler));
            }

            ////Contract.Requires(helpText != null);
            ////Contract.Requires(contextCommand != null);

            var menuItemInfo = new MenuItemInfo();

            menuItemInfo.InitializeSize();
            menuItemInfo.Id = menuHost.GetCommandId();

            customMenuHandler.InitializeItemInfo(ref menuItemInfo);

            InsertMenuItem(ref menuItemInfo, helpText, contextCommand, customMenuHandler);
        }
Example #6
0
        /// <summary>
        /// Adds the sub menu.
        /// </summary>
        /// <returns></returns>
        public Menu AddSubMenu(string helpText, CustomMenuHandler customMenuHandler)
        {
            ////Contract.Requires(helpText != null);
            ////Contract.Requires(customMenuHandler != null);

            IntPtr subMenu = CreateSubMenu();

            var menuItemInfo = new MenuItemInfo();

            menuItemInfo.InitializeSize();
            menuItemInfo.Id      = menuHost.GetCommandId();
            menuItemInfo.SubMenu = subMenu;

            customMenuHandler.InitializeItemInfo(ref menuItemInfo);

            InsertMenuItem(ref menuItemInfo, helpText, null, customMenuHandler);

            return(new Menu(subMenu, indexMenu, idCmdLast, menuHost));
        }
 private void InsertCommand(int id, uint icIndex, string icText, IntPtr hBitmap, Action icAction)
 {
     if (!form.IsHandleCreated)
     {
         // The form is not yet created, queue the command for later addition
         if (pendingCommands == null)
         {
             pendingCommands = new List <CommandInfo>();
         }
         pendingCommands.Add(new CommandInfo
         {
             Id          = id,
             Index       = (int)icIndex,
             Text        = icText,
             Action      = icAction,
             CommandType = SystemMenu.CommandType.InsertMenu,
             hBitmap     = hBitmap,
             Separator   = false
         });
     }
     else
     {
         MenuItemInfo mInfo = new MenuItemInfo()
         {
             cbSize        = (uint)Marshal.SizeOf(typeof(MenuItemInfo)),
             fMask         = InsMenuFlags,
             fType         = MenuItemInfo_fType.MFT_STRING,
             fState        = MenuItemInfo_fState.MFS_ENABLED,
             wID           = (uint)id,
             hbmpItem      = hBitmap,
             hbmpChecked   = hBitmap,
             hbmpUnchecked = hBitmap,
             dwTypeData    = Marshal.StringToHGlobalAuto(icText),
             dwItemData    = IntPtr.Zero,
             hSubMenu      = IntPtr.Zero,
             cch           = (uint)icText.Length,
         };
         // The form is created, add the command now
         InsertMenuItem(hSysMenu, icIndex, true, ref mInfo);
     }
     actions.Add(icAction);
 }
        protected virtual void OnContextMenu(List <MenuItemInfo> menuItems)
        {
            MenuItemInfo createFolder = new MenuItemInfo {
                Path = m_localization.GetString("ID_RTEditor_ProjectTreeView_CreateFolder", "Create Folder")
            };

            createFolder.Validate = new MenuItemValidationEvent();
            createFolder.Validate.AddListener(CreateFolderValidateContextMenuCmd);
            createFolder.Action = new MenuItemEvent();
            createFolder.Action.AddListener(CreateFolderContextMenuCmd);
            menuItems.Add(createFolder);

            MenuItemInfo duplicateFolder = new MenuItemInfo {
                Path = m_localization.GetString("ID_RTEditor_ProjectTreeView_Duplicate", "Duplicate")
            };

            duplicateFolder.Validate = new MenuItemValidationEvent();
            duplicateFolder.Validate.AddListener(DuplicateValidateContextMenuCmd);
            duplicateFolder.Action = new MenuItemEvent();
            duplicateFolder.Action.AddListener(DuplicateContextMenuCmd);
            menuItems.Add(duplicateFolder);

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

            deleteFolder.Validate = new MenuItemValidationEvent();
            deleteFolder.Validate.AddListener(DeleteFolderValidateContextMenuCmd);
            deleteFolder.Action = new MenuItemEvent();
            deleteFolder.Action.AddListener(DeleteFolderContextMenuCmd);
            menuItems.Add(deleteFolder);

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

            renameFolder.Validate = new MenuItemValidationEvent();
            renameFolder.Validate.AddListener(RenameValidateContextMenuCmd);
            renameFolder.Action = new MenuItemEvent();
            renameFolder.Action.AddListener(RenameFolderContextMenuCmd);
            menuItems.Add(renameFolder);
        }
        private void OnProjectFolderContextMenu(object sender, ProjectTreeContextMenuEventArgs e)
        {
            ILocalization lc          = IOC.Resolve <ILocalization>();
            MenuItemInfo  createAsset = new MenuItemInfo
            {
                Path = string.Format("{0}/{1}",
                                     lc.GetString("ID_RTScripting_ProjectFolderView_Create", "Create"),
                                     lc.GetString("ID_RTScripting_ProjectFolderView_Script", "Script"))
            };

            createAsset.Action = new MenuItemEvent();
            createAsset.Action.AddListener(arg =>
            {
                m_scriptManager.CreateScript(e.ProjectItem);
            });

            createAsset.Validate = new MenuItemValidationEvent();
            createAsset.Validate.AddListener(arg => arg.IsValid = e.ProjectItem == null || e.ProjectItem.IsFolder);
            e.MenuItems.Add(createAsset);
        }
Example #10
0
        public static string GetIconMenu(this MenuItemInfo field, List <LanguageInfo> languages)
        {
            if (field != null && !string.IsNullOrEmpty(field.MenuName))
            {
                field.MenuName = field.MenuName.Trim();
            }
            var languageText = "";
            var nameCheck    = string.Format("MENU.{0}.ICON", field.MenuName);
            var langCheck    = languages == null ? new List <LanguageInfo>() : languages.Where(x => x.LanguageName.ToUpper() == nameCheck.ToUpper());

            if (langCheck != null)
            {
                if (langCheck.Any())
                {
                    languageText = langCheck.First().LanguageValue;
                }
                return(languageText);
            }
            return(languageText);
        }
Example #11
0
        public void DisplayBidders()
        {
            MenuItemInfo[] menuItems = new MenuItemInfo[m_lucky7.Bidders.Count];

            for (int i = 0; i < m_lucky7.Bidders.Count; i++)
            {
                var item = m_lucky7.Bidders[i];

                MenuItemInfo menuItem = new MenuItemInfo
                {
                    Action = new MenuItemEvent(),
                    Icon   = item.Avatar,
                    Text   = item.Name
                };
                menuItem.Action.AddListener((args) => item.Display());
                menuItems[i] = menuItem;
            }

            m_globalUI.OpenGridMenu(menuItems, "BIDDERS", true);
        }
Example #12
0
        MenuItemInfo[] CreateContextMenu()
        {
            MenuItemInfo[] items = new MenuItemInfo[3];

            items[0] = new MenuItemInfo()
            {
                CommandType = MenuCommandType.SEND_FRIEND_REQUEST,
                Command     = "Send Friend Request",
                Text        = "Send Friend Request",
                Action      = new MenuItemEvent(),
                Data        = playerId,
                IsValid     = !IsAFriend()
            };

            items[0].Action.AddListener(OnContextItemClick);

            items[1] = new MenuItemInfo()
            {
                CommandType = MenuCommandType.INVITE_FOR_SEX,
                Command     = "Invite For Sex",
                Text        = "Invite For Sex",
                Action      = new MenuItemEvent(),
                Data        = playerId
            };

            items[1].Action.AddListener(OnContextItemClick);


            items[2] = new MenuItemInfo()
            {
                CommandType = MenuCommandType.OTHER,
                Command     = "Cancel",
                Text        = "Cancel",
                Action      = new MenuItemEvent(),
                Data        = playerId
            };

            items[2].Action.AddListener(OnContextItemClick);

            return(items);
        }
Example #13
0
        public override void Install(DirectoryInfo systemDirectory, string systemName, SpecialSnowflake specialSnowflake, string filename, out MenuItemInfo menuItem, SystemProgressReporter progressReporter)
        {
            FileInfo memtestFile = null;

            progressReporter.ReportStatus(InstallationStatus.ExtractFile);
            using (var fileStream = File.OpenRead(filename))
            {
                var zipFile = new ZipFile(fileStream);
                foreach (ZipEntry zipEntry in zipFile)
                {
                    if (zipEntry.Name.EndsWith(".bin", StringComparison.OrdinalIgnoreCase))
                    {
                        memtestFile = new FileInfo(Path.Combine(systemDirectory.FullName, zipEntry.Name));
                        using (var zipStream = zipFile.GetInputStream(zipEntry))
                            using (var memetestFileStream = memtestFile.OpenWrite())
                            {
                                var buffer    = new byte[4096];
                                var totalRead = 0d;
                                var length    = zipEntry.Size;
                                int read;
                                while ((read = zipStream.Read(buffer, 0, buffer.Length)) > 0)
                                {
                                    memetestFileStream.Write(buffer, 0, read);
                                    totalRead += read;
                                    progressReporter.ReportProgress(totalRead / length);
                                }
                            }
                        break;
                    }
                }
            }

            if (memtestFile == null)
            {
                throw new FileNotFoundException();
            }

            var pathWithoutDrive = RemoveDriveFromPath(memtestFile.FullName).Replace('\\', '/');

            menuItem = new MenuItemInfo($"LINUX {pathWithoutDrive}");
        }
Example #14
0
        void RunExe(MenuItemInfo menuItem)
        {
            try
            {
                if (menuItem.Type == MenuItemType.Exe)
                {
                    Process.Start(menuItem.FilePath);
                }
                else if (menuItem.Type == MenuItemType.Web)
                {
                    Process.Start(new ProcessStartInfo("cmd", $"/c start {menuItem.FilePath}")
                    {
                        UseShellExecute = false,
                        CreateNoWindow  = true
                    });
                }
                else if (menuItem.Type == MenuItemType.Cmd)
                {
                    Process p = new Process();
                    p.StartInfo.FileName               = "cmd";
                    p.StartInfo.UseShellExecute        = false;
                    p.StartInfo.RedirectStandardInput  = true;
                    p.StartInfo.RedirectStandardOutput = true;
                    p.StartInfo.RedirectStandardError  = true;
                    p.StartInfo.CreateNoWindow         = true;
                    p.Start();

                    p.StandardInput.WriteLine($"{menuItem.FilePath} &exit");
                    p.StandardInput.AutoFlush = true;
                    p.WaitForExit();
                    p.Close();
                }
                // 调用完应用,即折叠菜单
                btnOpenOrClose.IsChecked = true;
                btnOpenOrClose_Click(null, null);
            }
            catch (Exception ex)
            {
            }
        }
        private void Grid_Drop(object sender, DragEventArgs e)
        {
            try
            {
                var          fileName = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();
                MenuItemInfo menuItem = new MenuItemInfo()
                {
                    FilePath = fileName
                };

                // 快捷方式需要获取目标文件路径
                if (fileName.ToLower().EndsWith("lnk"))
                {
                    WshShell     shell       = new WshShell();
                    IWshShortcut wshShortcut = (IWshShortcut)shell.CreateShortcut(fileName);
                    menuItem.FilePath = wshShortcut.TargetPath;
                }
                ImageSource        imageSource = SystemIcon.GetImageSource(true, menuItem.FilePath);
                System.IO.FileInfo file        = new System.IO.FileInfo(fileName);
                if (string.IsNullOrWhiteSpace(file.Extension))
                {
                    menuItem.Name = file.Name;
                }
                else
                {
                    menuItem.Name = file.Name.Substring(0, file.Name.Length - file.Extension.Length);
                }
                menuItem.Type = MenuItemType.Exe;

                if (ConfigHelper.AddNewMenuItem(menuItem))
                {
                    var btn = AddMenuItem(menuItem);
                    fishButtons.Children.Add(btn);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #16
0
        /// <summary>
        /// 指定されたメニューにアクセス可能か判定する
        /// </summary>
        /// <param name="menu">メニュー</param>
        /// <returns>アクセス可能な場合、true</returns>
        public async Task <bool> IsAccessibleMenuAsync(MenuItemInfo menu)
        {
            if (menu.MenuType == MenuType.Public || menu.MenuType == MenuType.Internal)
            {
                //公開済みメニューなら無条件で許可
                return(true);
            }

            //現在のロールを取得
            IEnumerable <Role> roles = menu.MenuType == MenuType.System ?
                                       CurrentUserInfo.SystemRoles : //システムメニューの場合はシステムロールを確認
                                       CurrentUserInfo.SelectedTenantRoles;

            foreach (var role in roles)
            {
                if (await roleRepository.AuthorizeAsync(role.Id, menu.Code))
                {
                    return(true);
                }
            }
            return(false);
        }
Example #17
0
        public override IMenuItem SpawnMenuItem(MenuItemInfo menuItemInfo, GameObject prefab, Transform parent)
        {
            if (menuItemInfo.Action == null)
            {
                menuItemInfo.Action = new MenuItemEvent();
            }

            menuItemInfo.Action.AddListener(OnTabClick);

            var            menuItem       = base.SpawnMenuItem(menuItemInfo, prefab, parent);
            TabInteraction tabInteraction = (TabInteraction)menuItem;
            var            toggle         = (Toggle)tabInteraction.Selectable;

            toggle.group = m_toggleGroup;
            if (m_menuItems.Count == 1 && !m_allowSwitchOff)
            {
                toggle.isOn = true;
            }

            InitializeTab((ITabItem)menuItem);
            return(menuItem);
        }
Example #18
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());
            }
        }
Example #19
0
        private void InitMenu()
        {
            menuHub     = new MenuHub(menuName);
            _menuSource = new ObservableCollection <MenuItemInfo>();
            MenuItemInfo menu1 = new MenuItemInfo("菜单1", Menu1Command)
            {
                GroupName = "Group1"
            };
            MenuItemInfo menu2 = new MenuItemInfo("菜单2", Menu2Command)
            {
                GroupName = "Group1"
            };
            MenuItemInfo menu3 = new MenuItemInfo("菜单3", Menu3Command)
            {
                GroupName = "Group2"
            };
            MenuItemInfo menu4 = new MenuItemInfo("菜单4", Menu4Command)
            {
                GroupName = "Group2"
            };

            //菜单项还可以通过一下方式定义,CommandName为全局命令中定义的命令名称
            //MenuItemInfo menu4 = new MenuItemInfo("菜单4", "CommandName") { GroupName = "Group2" };
            menu1.SubItems.Add(menu2);
            menu1.SubItems.Add(menu3);
            //向全局注册菜单
            menuHub.Register(menuName, menu1, 1);
            menuHub.Register(menuName, menu2, 2);
            menuHub.Register(menuName, menu3, 3);
            menuHub.Register(menuName, menu4, 4);

            //_menuSource.Add(menu1);
            //_menuSource.Add(menu2);
            //_menuSource.Add(menu3);
            //_menuSource.Add(menu4);
            //GetMenuItemInfos 为获取合并后的右键菜单
            //_menuSource = menuHub.GetMenuItemInfos(menuNames.Where(t=>t== "menu1"))?.ToList();
        }
Example #20
0
        private MenuItemGrupo criarGrupoAcao()
        {
            var grupo = new MenuItemGrupo("AÇÕES", "AÇÕES");

            grupo.Add(new MenuItemInfo
            {
                Titulo     = "Percursos",
                Icone      = "percursos.png",
                TargetType = typeof(PercursoPage)
            });
            grupo.Add(new MenuItemInfo
            {
                Titulo     = "Meus Radares",
                Icone      = "meusradares.png",
                TargetType = typeof(RadarListaPage)
            });
            grupo.Add(new MenuItemInfo
            {
                Titulo     = "Preferências",
                Icone      = "config.png",
                TargetType = typeof(PreferenciaPage)
            });
            var menuAtualizar = new MenuItemInfo
            {
                Titulo     = "Atualizar",
                Icone      = "atualizar.png",
                TargetType = null,
            };

            menuAtualizar.aoClicar += (sender, e) =>
            {
                //var downloader = new DownloaderUtils();
                var downloader = new DownloaderAtualizacao();
                downloader.download();
            };
            grupo.Add(menuAtualizar);
            return(grupo);
        }
Example #21
0
        public static MenuItemInfo[] GetCategoryMenu(ResourceComponent[] categories, ResourceType resourceType)
        {
            if (categories == null)
            {
                return new MenuItemInfo[] { }
            }
            ;

            MenuItemInfo[] categoryItems = new MenuItemInfo[categories.Length];
            for (int i = 0; i < categories.Length; i++)
            {
                categoryItems[i] = new MenuItemInfo
                {
                    Path        = categories[i].Name,
                    Text        = categories[i].Name,
                    Command     = categories[i].Name,
                    Icon        = categories[i].Preview,
                    Data        = categories[i],
                    CommandType = MenuCommandType.CATEGORY_SELECTION
                };
            }
            return(categoryItems);
        }
Example #22
0
        public void QueryTest([Values] CMF cmf)
        {
            using var pshi  = ComReleaserFactory.Create(SHCreateItemFromParsingName <IShellItem>(TestCaseSources.WordDoc));
            using var pcm   = ComReleaserFactory.Create(pshi.Item.BindToHandler <IContextMenu>(null, BHID.BHID_SFUIObject.Guid()));
            using var hmenu = CreatePopupMenu();
            Assert.That(pcm.Item.QueryContextMenu(hmenu, 0, 1, int.MaxValue, cmf), ResultIs.Successful);
            var miis = MenuItemInfo.GetMenuItems(hmenu);

            using var memstr = new SafeCoTaskMemString(1024, CharSet.Ansi);
            for (int i = 0; i < miis.Length; i++)
            {
                ShowMII(miis[i], i);
            }
            if (cmf == CMF.CMF_NORMAL)
            {
                var oid = miis.First(m => m.Verb == "properties").Id;
                var cix = new CMINVOKECOMMANDINFOEX((int)oid - 1);
                pcm.Item.InvokeCommand(cix);
            }

            void ShowMII(MenuItemInfo mii, int c, int indent = 0)
            {
                mii.Verb = mii.Type == MenuItemType.MFT_STRING && pcm.Item.GetCommandString((IntPtr)(int)(mii.Id - 1), GCS.GCS_VERBA, default, memstr, memstr.Size) == HRESULT.S_OK ? memstr.ToString() : "";
Example #23
0
        private void inicializarComponente()
        {
            var paginas = new List <MenuItemGrupo>();

            paginas.Add(criarGrupoModo());
            paginas.Add(criarGrupoAcao());
            paginas.Add(criarGrupoAplicativo());

            _listView = new ListView
            {
                GroupDisplayBinding = new Binding("Nome"),
                HasUnevenRows       = false,
                SeparatorVisibility = SeparatorVisibility.Default,
                IsGroupingEnabled   = true,
                BackgroundColor     = Color.Transparent,
                SeparatorColor      = Color.FromHex("#bdbdbd"),
                GroupHeaderTemplate = new DataTemplate(typeof(MenuGrupoCell)),
                ItemTemplate        = new DataTemplate(typeof(MenuItemCell))
            };
            _listView.SetBinding(ListView.ItemsSourceProperty, new Binding("."));
            _listView.ItemsSource = paginas;
            _listView.ItemTapped += (sender, e) => {
                MenuItemInfo item = (MenuItemInfo)e.Item;
                if (item.aoClicar != null)
                {
                    if (this.Navigation.NavigationStack.Count == 1)
                    {
                        item.aoClicar(sender, new MenuEventArgs(this));
                    }
                }
            };

            _listView.Footer = new Label()
            {
                Text = ""
            };
        }
Example #24
0
        private void InitMenu()
        {
            menuHub = new MenuHub(menuName);
            var menu1 = new MenuItemInfo("菜单1", new RelayCommand(ShowWindow))
            {
                GroupName = "Group1"
            };
            var menu2 = new MenuItemInfo("菜单2", new RelayCommand(ShowWindow))
            {
                GroupName = "Group1"
            };
            var menu3 = new MenuItemInfo("菜单3", new RelayCommand(ShowWindow))
            {
                GroupName = "Group2"
            };
            var menu4 = new MenuItemInfo("菜单4", new RelayCommand(ShowWindow))
            {
                GroupName = "Group2"
            };

            menu1.SubItems.AddRange(new[] { menu2, menu3 });
            //向全局注册菜单
            menuHub.Register(menuName, menu1, 1);
            menuHub.Register(menuName, menu2, 2);
            menuHub.Register(menuName, menu3, 3);
            menuHub.Register(menuName, menu4, 4);
            MenuSource = new ObservableCollection <MenuItemInfo>();//绑定界面的RadContextMenu的菜单集合
            var list = menuHub.GetMenuItemInfos(new List <string>()
            {
                menuName
            });                                                                  //GetMenuItemInfos 为获取合并后的右键菜单

            if (list != null)
            {
                MenuSource.AddRange(list);
            }
        }
        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 menuItem_Click(object sender, RoutedEventArgs e)
        {
            MenuItem     item = sender as MenuItem;
            MenuItemInfo obj  = (MenuItemInfo)(item.Tag);

            if (obj.OpenType == (int)OpenType.NewUsercontrol)
            {
                UserControl uc = uch.Get_PathDll_Usercontrol(obj.FormName, obj.MenuName);
                if (uc != null)
                {
                    MainContent.Children.Clear();

                    MainContent.Children.Add(uc);
                }
            }
            else
            {
                Window window = uch.Get_PathDll_Window(obj.FormName, obj.MenuName);
                if (window != null)
                {
                    window.Show();
                }
            }
        }
Example #27
0
        public OpMenuItem(ulong key, uint id, string text, MenuItemInfo info)
            : base(text, null, info.ClickEvent)
        {
            UserID = key;
            ProjectID = id;
            Info = info;

            if(info.Symbol != null)
                Image = info.Symbol;
        }
 public abstract void Install(DirectoryInfo systemDirectory, string systemName, SpecialSnowflake specialSnowflake,
                              string filename, out MenuItemInfo menuItem, SystemProgressReporter progressReporter);
Example #29
0
        public ServiceNavItem(MenuItemInfo info, ulong id, uint project, EventHandler onClick)
            : base("", null, onClick)
        {
            UserID = id;
            ProjectID = project;

            string[] parts = info.Path.Split(new char[] { '/' });

            if (parts.Length == 2)
                Text = parts[1];

            Font = new System.Drawing.Font("Tahoma", 8.25F);

            if (info.Symbol != null)
                Image = info.Symbol;
        }
Example #30
0
        public OpStripItem(ulong key, uint id, bool external, string text, MenuItemInfo info)
            : base(text, null, info.ClickEvent)
        {
            UserID = key;
            ProjectID = id;
            Info = info;
            External = external;

            Image = Info.Symbol;
        }
Example #31
0
 public static extern bool GetMenuItemInfo(IntPtr hMenu, Int32 item, bool bByPosition, [MarshalAs(UnmanagedType.LPStruct)][In][Out] MenuItemInfo mii);
        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);

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

                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());
            }
        }
Example #33
0
        uint AddPopupItem(uint hMenu, MenuItem item, uint position)
        {
            uint popup = Helpers.CreatePopupMenu();

            MenuItemInfo mii = new MenuItemInfo();
            mii.cbSize = 48;
            mii.fMask = (uint)MIIM.Type | (uint)MIIM.State | (uint)MIIM.SubMenu;
            mii.hSubMenu = (int)popup;
            mii.fType = (uint)MenuFlags.String;
            mii.dwTypeData = item.Text;
            mii.fState = (uint)MenuFlags.Enabled;
            Helpers.InsertMenuItem(hMenu, position, 1, ref mii);

            return popup;
        }
Example #34
0
 protected void btnAddMenuItem_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         int MenuItemId = int.Parse(hfMenuItemId.Value);
         int menuId = db.Menus.Where(t => t.ModuleId == this.ModuleId).FirstOrDefault().MenuId;
         int MenuOrder = -1;
         if (txtMenuOrder.Text == "")
         {
             if (MenuItemId == -1)
             {
                 int ParentId = int.Parse(ddlParent.SelectedValue);
                 var menuItems = db.MenuItems.Where(t => t.MenuId == menuId && t.ParentId == ParentId && t.MenuItemId != MenuItemId).ToList();
                 MenuOrder = menuItems.Count + 1;
             }
         }
         else
         {
             MenuOrder = int.Parse(txtMenuOrder.Text);
         }
         if (rbtLinkType.SelectedValue == "page")
         {
             if (MenuItemId != -1)
             {
                 var menuItem = db.MenuItems.Find(MenuItemId);
                 menuItem.ParentId = int.Parse(ddlParent.SelectedValue);
                 if (txtMenuOrder.Text != "")
                 {
                     menuItem.MenuOrder = int.Parse(txtMenuOrder.Text);
                 }
                 db.Entry(menuItem).State = EntityState.Modified;
                 db.SaveChanges();
                 btnAddMenuItem.Text = "Add menu item";
                 btnCancelMenuItem.Visible = false;
                 hfMenuItemId.Value = "-1";
             }
             else
             {
                 foreach (ListItem item in chkListPages.Items)
                 {
                     if (item.Selected && item.Enabled == true)
                     {
                         if (txtMenuOrder.Text == "")
                         {
                             if (MenuItemId == -1)
                             {
                                 int ParentId = int.Parse(ddlParent.SelectedValue);
                                 var menuItems = db.MenuItems.Where(t => t.MenuId == menuId && t.ParentId == ParentId && t.MenuItemId != MenuItemId).ToList();
                                 MenuOrder = menuItems.Count + 1;
                             }
                         }
                         else
                         {
                             MenuOrder = int.Parse(txtMenuOrder.Text);
                         }
                         var menuItem = new MenuItemInfo();
                         menuItem.MenuId = menuId;
                         menuItem.LinkType = "page";
                         menuItem.ParentId = int.Parse(ddlParent.SelectedValue);
                         menuItem.PageId = int.Parse(item.Value);
                         menuItem.MenuOrder = MenuOrder;
                         menuItem.OpenInNewWindow = false;
                         db.MenuItems.Add(menuItem);
                         db.SaveChanges();
                     }
                 }
             }
         }
         else if (rbtLinkType.SelectedValue == "link")
         {
             if (MenuItemId != -1)
             {
                 var menuItem = db.MenuItems.Find(MenuItemId);
                 menuItem.Title = txtTitle.Text;
                 menuItem.LinkUrl = txtLinkUrl.Text;
                 menuItem.OpenInNewWindow = chkOpenInNewWindow.Checked;
                 menuItem.ParentId = int.Parse(ddlParent.SelectedValue);
                 if (txtMenuOrder.Text != "")
                 {
                     menuItem.MenuOrder = int.Parse(txtMenuOrder.Text);
                 }
                 db.Entry(menuItem).State = EntityState.Modified;
                 db.SaveChanges();
                 btnAddMenuItem.Text = "Add menu item";
                 btnCancelMenuItem.Visible = false;
                 hfMenuItemId.Value = "-1";
             }
             else
             {
                 int MenuId = db.Menus.Where(t => t.ModuleId == this.ModuleId).FirstOrDefault().MenuId;
                 var menuItem = new MenuItemInfo();
                 menuItem.MenuId = MenuId;
                 menuItem.LinkType = "link";
                 menuItem.ParentId = int.Parse(ddlParent.SelectedValue);
                 menuItem.MenuOrder = MenuOrder;
                 menuItem.Title = txtTitle.Text;
                 menuItem.LinkUrl = txtLinkUrl.Text;
                 menuItem.OpenInNewWindow = chkOpenInNewWindow.Checked;
                 db.MenuItems.Add(menuItem);
                 db.SaveChanges();
             }
         }
         BindingParentMenuItems();
         BindingPages();
         BindingMenuItems();
         ResetItem();
     }
 }
        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());
            }
        }
 /// <inheritdoc />
 public override void InitializeItemInfo(ref MenuItemInfo menuiteminfo)
 {
     menuiteminfo.Text = text;
     menuiteminfo.SetCheckMarks(IntPtr.Zero, bitmap.GetHbitmap());
 }
Example #37
0
        void AddMenuItem(uint hMenu, MenuItem item, uint position)
        {
            int id = current_id;

            MenuItemInfo mii = new MenuItemInfo();
            mii.cbSize = 48;
            mii.fMask = (uint)MIIM.ID | (uint)MIIM.Type | (uint)MIIM.State;
            mii.wID = id;
            mii.fType = (uint)MenuFlags.String;
            mii.dwTypeData = item.Text;
            mii.fState = (uint)MenuFlags.Enabled;
            Helpers.InsertMenuItem(hMenu, position, 1, ref mii);

            actions_hash[id] = item;
            current_id = ++id;
        }