/// <summary> /// Invokes a specific command from an IContextMenu /// </summary> /// <param name="iContextMenu">the IContextMenu containing the item</param> /// <param name="cmd">the index of the command to invoke</param> /// <param name="parentDir">the parent directory from where to invoke</param> /// <param name="ptInvoke">the point (in screen codinates) from which to invoke</param> public static void InvokeCommand(IContextMenu iContextMenu, uint cmd, string parentDir, System.Windows.Point ptInvoke) { CMINVOKECOMMANDINFOEX invoke = new CMINVOKECOMMANDINFOEX(); invoke.cbSize = Shell32Wrapper.cbInvokeCommand; invoke.lpVerb = (IntPtr)cmd; invoke.lpDirectory = parentDir; invoke.lpVerbW = (IntPtr)cmd; invoke.lpDirectoryW = parentDir; //invoke.fMask = CMIC.UNICODE | CMIC.PTINVOKE | // ((Control.ModifierKeys & Keys.Control) != 0 ? CMIC.CONTROL_DOWN : 0) | // ((Control.ModifierKeys & Keys.Shift) != 0 ? CMIC.SHIFT_DOWN : 0); invoke.fMask = CMIC.UNICODE | CMIC.PTINVOKE; invoke.ptInvoke = new POINT() { x = (int)ptInvoke.X, y = (int)ptInvoke.Y }; invoke.nShow = SW.SHOWNORMAL; iContextMenu.InvokeCommand(ref invoke); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { menu.Add("One"); menu.Add("Two"); menu.Add("Three"); menu.Add("Four"); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo acmi = (AdapterView.AdapterContextMenuInfo) menuInfo; ClickView cv = (ClickView) acmi.TargetView; cv.OnCreateMenu(menu, menuInfo); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateOptionsMenu(menu); MenuInflater inflater = this.MenuInflater; switch (v.Tag.ToString()) { case "ULGIRO": inflater.Inflate(Resource.Menu.EulgiMenu, menu); break; case "JONGRO": inflater.Inflate(Resource.Menu.JongroMenu, menu); break; case "MYENGDONG": inflater.Inflate(Resource.Menu.MyeongdongMenu, menu); break; case "GANGNAM": inflater.Inflate(Resource.Menu.GangnamMenu, menu); break; case "TERMINAL": inflater.Inflate(Resource.Menu.TerminalMenu, menu); break; case "YEONGDEONGPO": inflater.Inflate(Resource.Menu.YeongdeungpoMenu, menu); break; } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); menu.Add("Up"); menu.Add("Down"); }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Ansi) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; iContextMenu.GetCommandString( idcmd, (executeString ? GCS.VerbA : GCS.HelpTextA), 0, bytes, ShellApi.MaxPath); int index = 0; while (index < bytes.Length && bytes[index] != 0) { index++; } if (index < bytes.Length) { info = Encoding.Default.GetString(bytes, 0, index); } return info; }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); if (v != null && v.Id == Resource.Id.allTasksListView) { var info = (AdapterView.AdapterContextMenuInfo)menuInfo; IEnumerator <Goal> enumerator = allGoalsCollection.GetEnumerator(); enumerator.Reset(); for (int i = 0; i <= info.Position; i++) { enumerator.MoveNext(); } Goal currentGoal = enumerator.Current; menu.SetHeaderTitle(currentGoal.TaskDescription); // TODO: Handle menu items being clicked string[] menuItems = new string[3] { "Complete", "Edit", "Delete" }; for (var i = 0; i < menuItems.Length; i++) { menu.Add(Menu.None, i, i, menuItems[i]); } } }
/// <summary>Gets the interfaces to the context menu.</summary> /// <param name="oParentFolder">Parent folder.</param> /// <param name="arrPIDLs">PIDLs.</param> /// <returns>true if it got the interfaces, otherwise false.</returns> private bool GetContextMenuInterfaces(IShellFolder oParentFolder, IntPtr[] arrPIDLs, out IntPtr ctxMenuPtr) { int nResult = oParentFolder.GetUIObjectOf( IntPtr.Zero, (uint)arrPIDLs.Length, arrPIDLs, ref iidIContextMenu, IntPtr.Zero, out ctxMenuPtr); if (nResult == ResultOK) { oContextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown(ctxMenuPtr, typeof(IContextMenu)); /*IntPtr pUnknownContextMenu2 = IntPtr.Zero; * if (S_OK == Marshal.QueryInterface(pUnknownContextMenu, ref IID_IContextMenu2, out pUnknownContextMenu2)) * { * _oContextMenu2 = (IContextMenu2)Marshal.GetTypedObjectForIUnknown(pUnknownContextMenu2, typeof(IContextMenu2)); * } * IntPtr pUnknownContextMenu3 = IntPtr.Zero; * if (S_OK == Marshal.QueryInterface(pUnknownContextMenu, ref IID_IContextMenu3, out pUnknownContextMenu3)) * { * _oContextMenu3 = (IContextMenu3)Marshal.GetTypedObjectForIUnknown(pUnknownContextMenu3, typeof(IContextMenu3)); * }*/ return(true); } else { ctxMenuPtr = IntPtr.Zero; oContextMenu = null; return(false); } }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Unicode) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; iContextMenu.GetCommandString( idcmd, (executeString ? ShellAPI.GCS.VERBW : ShellAPI.GCS.HELPTEXTW), 0, bytes, ShellAPI.MAX_PATH); int index = 0; while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0)) { index += 2; } if (index < bytes.Length - 1) { info = Encoding.Unicode.GetString(bytes, 0, index + 1); } return info; }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Unicode) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; iContextMenu.GetCommandString( idcmd, (executeString ? GCS.VerbW : GCS.HelpTextW), 0, bytes, ShellApi.MaxPath); int index = 0; while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0)) { index += 2; } if (index < bytes.Length - 1) { info = Encoding.Unicode.GetString(bytes, 0, index + 1); } return info; }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Ansi) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; iContextMenu.GetCommandString( idcmd, (executeString ? ShellAPI.GCS.VERBA : ShellAPI.GCS.HELPTEXTA), 0, bytes, ShellAPI.MAX_PATH); int index = 0; while (index < bytes.Length && bytes[index] != 0) { index++; } if (index < bytes.Length) { info = Encoding.Default.GetString(bytes, 0, index); } return info; }
/// <summary> /// Release all allocated interfaces, PIDLs /// </summary> private void ReleaseAll() { if (null != _oContextMenu) { Marshal.ReleaseComObject(_oContextMenu); _oContextMenu = null; } if (null != _oContextMenu2) { Marshal.ReleaseComObject(_oContextMenu2); _oContextMenu2 = null; } if (null != _oContextMenu3) { Marshal.ReleaseComObject(_oContextMenu3); _oContextMenu3 = null; } if (null != _oDesktopFolder) { Marshal.ReleaseComObject(_oDesktopFolder); _oDesktopFolder = null; } if (null != _oParentFolder) { Marshal.ReleaseComObject(_oParentFolder); _oParentFolder = null; } if (null != _arrPIDLs) { FreePIDLs(_arrPIDLs); _arrPIDLs = null; } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu (menu, v, menuInfo); menu.Add(Menu.None, Resource.Id.a_item, Menu.None, "Menu A"); menu.Add(Menu.None, Resource.Id.b_item, Menu.None, "Menu B"); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo info) { base.OnCreateOptionsMenu(menu); menu.SetHeaderTitle("Выберите действие"); menu.Add(0, MENU_ITEM_EDIT, 0, "Редактировать"); menu.Add(0, MENU_ITEM_DELETE, 0, "Удалить"); }
private void DispatchCommand(IContextMenu contextMenu, int command) { if (command == 0) { return; } if (actions.ContainsKey(command)) { actions[command](); return; } var invoke = new CMINVOKECOMMANDINFO_ByIndex(); invoke.cbSize = Marshal.SizeOf(invoke); invoke.iVerb = command - FirstCmd; invoke.nShow = 1 /*SW_SHOWNORMAL*/; var contextMenu2 = contextMenu as IContextMenu2; try { contextMenu2.InvokeCommand(ref invoke); } catch (COMException) { // Invocation of some commands raises exceptions. The base we can do is to catch them. } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu (menu, v, menuInfo); menu.Add (0, 0, 0, "Hide App"); menu.Add (0, 1, 1, "Uninstall App"); }
public static bool GetIContextMenu( IShellFolder parent, IntPtr[] pidls, out IntPtr icontextMenuPtr, out IContextMenu iContextMenu) { if (parent.GetUIObjectOf( IntPtr.Zero, (uint)pidls.Length, pidls, ref ShellFolders.IID_IContextMenu, IntPtr.Zero, out icontextMenuPtr) == ShellFolders.S_OK) { iContextMenu = (IContextMenu)Marshal.GetTypedObjectForIUnknown( icontextMenuPtr, typeof(IContextMenu)); return(true); } else { icontextMenuPtr = IntPtr.Zero; iContextMenu = null; return(false); } }
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()); } }
public static void DisableMenuItems(IntPtr menu, IContextMenu contextMenu, string[] disabledCommands, DisabledMethods method) { if (disabledCommands == null || disabledCommands.Length == 0) { return; } foreach (int cmdID in GetMenuItemID(menu, contextMenu, disabledCommands, MenuIDTypes.CommadID)) { if (cmdID != -1) { switch (method) { case DisabledMethods.Remove: ShellAPI.RemoveMenu(menu, (uint)cmdID, ShellAPI.MFT.BYCOMMAND); break; case DisabledMethods.Gray: ShellAPI.EnableMenuItem(menu, (uint)cmdID, ShellAPI.MF_GRAYED); break; case DisabledMethods.Disable: ShellAPI.EnableMenuItem(menu, (uint)cmdID, ShellAPI.MF_DISABLED); break; } } } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); MenuInflater m = ct.MenuInflater; m.Inflate(Resource.Menu.context_menu, menu); }
internal static Dictionary <uint, MenuItemInfo> GetMenuItemInfo(IntPtr menu, IContextMenu contextMenu) { Dictionary <uint, MenuItemInfo> retVal = new Dictionary <uint, MenuItemInfo>(); int totalItems = ShellAPI.GetMenuItemCount(menu); for (int i = 0; i < totalItems; i++) { uint cmdID = ShellAPI.GetMenuItemID(menu, i); StringBuilder textsb = new StringBuilder(256); ShellAPI.GetMenuString(menu, (uint)i, textsb, textsb.Capacity, ShellAPI.MF_BYPOSITION); string command = ""; if (cmdID > 0 && cmdID <= ShellAPI.CMD_LAST) { command = ContextMenuHelper.GetCommandString( contextMenu, cmdID - ShellAPI.CMD_FIRST, true); } retVal.Add((uint)i, new MenuItemInfo() { RelativePosition = (uint)i, CommandID = cmdID, Text = textsb.ToString(), Command = command }); } foreach (MenuItemInfo item in retVal.Values) { Debug.WriteLine(String.Format("{0} - {1} {2} ({3})", item.RelativePosition, item.CommandID, item.Command, item.Text)); } return(retVal); }
void Awake() { Client.GameStarted += StartGame; CurrentMenu = StartScreen.Instance(); CurrentContextMenu = EmptyContextMenu.Instance(); State = GameState.START_SCREEN; MaximumPlayers = StartPoints.Count; FieldWidth = fieldwidth; FieldHeight = fieldheight; GroundWidth = groundwidth; GroundHeight = groundheight; Players = players; Field.Width = FieldWidth; Field.Height = FieldHeight; Ground.Width = GroundWidth; Ground.Height = GroundHeight; StartPoints.Add(new Point(0 - (Ground.Width / 2), 0 - (Ground.Height / 2))); StartPoints.Add(new Point(0 - (Ground.Width / 2), (Ground.Height / 2) - 1)); StartPoints.Add(new Point(Ground.Width / 2, Ground.Height / 2)); StartPoints.Add(new Point(Ground.Width / 2, 0 - ((Ground.Height / 2) - 1))); Rectangles.Add(new Rect(0 - Ground.Width / 2, 0 - Ground.Height / 2, Ground.Width, Ground.Height)); Rectangles.Add(new Rect(0 - Field.Width / 2, 0 - Field.Height / 2, Field.Width, Field.Height)); SpellList.Add(Fireball.Instance()); SpellList.Add(Blink.Instance()); }
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()); } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); MenuInflater.Inflate(Resource.Menu.opciones_contextuales, menu); menu.SetHeaderIcon(Resource.Drawable.agregar); menu.SetHeaderTitle("Menu contextual"); }
public void Init(PluginInitContext context) { Context = context; viewModel = new SettingsViewModel(context); Settings = viewModel.Settings; contextMenu = new ContextMenu(Context, Settings); }
private void ContextMenuStrip_Opening(object sender, CancelEventArgs e) { ContextMenuStrip strip = (ContextMenuStrip) sender; if ((strip.Items.Count <= 1) && (strip.Items[0].Text == string.Empty)) { if ((this.ContextMenu == null) && (this.FileNames != null)) { this.ContextMenu = GetContextMenu(this.Owner, this.ParentName, this.FileNames); } if (this.ContextMenu == null) { e.Cancel = true; } else { this.ContextMenu3 = this.ContextMenu as IContextMenu3; if (this.ContextMenu3 == null) { this.ContextMenu2 = this.ContextMenu as IContextMenu2; } this.Menu = Windows.CreatePopupMenu(); this.ContextMenu.QueryContextMenu(this.Menu, 0, 1, 0x7fff, this.Options | (((Control.ModifierKeys & Keys.Shift) > Keys.None) ? CMF.CMF_EXTENDEDVERBS : CMF.CMF_NORMAL)); if (this.ContextMenu3 != null) { this.ContextMenu3.HandleMenuMsg2(0x117, this.Menu, IntPtr.Zero, IntPtr.Zero); } else if (this.ContextMenu2 != null) { this.ContextMenu2.HandleMenuMsg(0x117, this.Menu, IntPtr.Zero); } this.InitializeToolStrip(strip, this.Menu); } } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { var info = (AdapterView.AdapterContextMenuInfo)menuInfo; var contact = _adapter[info.Position]; _menuManager.CreateMenu(menu, contact); }
public void Init(PluginInitContext context) { _context = context; _contextMenuLoader = new ContextMenuLoader(context); InitialDriverList(); LoadEnvironmentStringPaths(); }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Unicode) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringW(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; int index; iContextMenu.GetCommandString( idcmd, (executeString ? ShellFolders.GCS.VERBW : ShellFolders.GCS.HELPTEXTW), 0, bytes, ShellFolders.MAX_PATH); index = 0; while (index < bytes.Length - 1 && (bytes[index] != 0 || bytes[index + 1] != 0)) { index += 2; } if (index < bytes.Length - 1) { info = Encoding.Unicode.GetString(bytes, 0, index); } return(info); }
public override void OnCreateContextMenu (IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { menu.Add ("One"); menu.Add ("Two"); menu.Add ("Three"); menu.Add ("Four"); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { var info = (AdapterView.AdapterContextMenuInfo)menuInfo; var msg = _adapter[(int)info.Id]; _menuManager.CreateMenu(menu, msg); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); menu.Add(Menu.None, Resource.Id.a_item, Menu.None, "Menu A"); menu.Add(Menu.None, Resource.Id.b_item, Menu.None, "Menu B"); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo info) { base.OnCreateOptionsMenu (menu); menu.SetHeaderTitle("Выберите действие"); menu.Add(0, MENU_ITEM_EDIT, 0, "Редактировать"); menu.Add(0, MENU_ITEM_DELETE, 0, "Удалить"); }
public void OnCreateContextMenu(IContextMenu menu, Android.Views.View v, IContextMenuContextMenuInfo menuInfo) { var collectionView = (YuCollectionView)Element; if (collectionView.MenuContext != null) { var menuContext = collectionView.MenuContext; if (menuContext.ItemsSource != null) { var items = menuContext.ItemsSource; if (!string.IsNullOrEmpty(menuContext.Title)) { menu.SetHeaderTitle(menuContext.Title); } foreach (var item in items) { var menuItem = (MenuItem)item; var mi = menu.Add(0, v.Id, 0, menuItem.Name); mi.SetOnMenuItemClickListener(this); } } } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); MenuInflater inflater = new MenuInflater(Activity.ApplicationContext); inflater.Inflate(Resource.Menu.ContextMenu, menu); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { if (v.Id == Resource.Id.songsListView) { var info = (AdapterView.AdapterContextMenuInfo)menuInfo; selectedSong = songs[info.Position]; menu.SetHeaderTitle(GetSelectedSongTitle()); Drawable picture = SongMetadata.GetSongPicture(selectedSong.Id); if (picture != null) { menu.SetHeaderIcon(picture); } else { menu.SetHeaderIcon(Resource.Drawable.default_song_image); } var inflater = MenuInflater; inflater.Inflate(Resource.Menu.song_actions_menu, menu); if (mediaPlayer.CurrentSong != null && mediaPlayer.IsPlaying && selectedSong.Id == mediaPlayer.CurrentSong.Id) { menu.FindItem(Resource.Id.seek_bar).SetVisible(true); } } }
public Task InitAsync(PluginInitContext context) { Context = context; viewModel = new SettingsViewModel(context); Settings = viewModel.Settings; contextMenu = new ContextMenu(Context); pluginManager = new PluginsManager(Context, Settings); var updateManifestTask = pluginManager.UpdateManifest(); _ = updateManifestTask.ContinueWith(t => { if (t.IsCompletedSuccessfully) { lastUpdateTime = DateTime.Now; } else { context.API.ShowMsg("Plugin Manifest Download Fail.", "Please check if you can connect to github.com. " + "This error means you may not be able to Install and Update Plugin.", pluginManager.icoPath, false); } }); return(Task.CompletedTask); }
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 }); } }
/// <summary> /// Retrieves the command string for a specific item from an iContextMenu (Ansi) /// </summary> /// <param name="iContextMenu">the IContextMenu to receive the string from</param> /// <param name="idcmd">the id of the specific item</param> /// <param name="executeString">indicating whether it should return an execute string or not</param> /// <returns>if executeString is true it will return the executeString for the item, /// otherwise it will return the help info string</returns> public static string GetCommandStringA(IContextMenu iContextMenu, uint idcmd, bool executeString) { string info = string.Empty; byte[] bytes = new byte[256]; int index; iContextMenu.GetCommandString( idcmd, (executeString ? ShellFolders.GCS.VERBA : ShellFolders.GCS.HELPTEXTA), 0, bytes, ShellFolders.MAX_PATH); index = 0; while (index < bytes.Length && bytes[index] != 0) { index++; } if (index < bytes.Length) { info = Encoding.Default.GetString(bytes, 0, index); } return(info); }
void View.IOnCreateContextMenuListener.OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { if (OnCreateContextMenu != null) { OnCreateContextMenu(menu, v, menuInfo); } }
public BeforePopupEventArgs(IntPtr ptrPopupMenu, IContextMenu iContextMenu, uint defaultCommandID, string defaultCommand) { this.ptrPopupMenu = ptrPopupMenu; this.iContextMenu = iContextMenu; ContinuePopup = true; DefaultCommandID = defaultCommandID; DefaultCommand = defaultCommand; }
public override void OnCreateContextMenu (IContextMenu menu, View view, IContextMenuContextMenuInfo menuInfo) { var info = (AdapterView.AdapterContextMenuInfo)menuInfo; var note = (Note)ListAdapter.GetItem (info.Position); // Add a menu item to delete the note menu.Add (0, MENU_ITEM_DELETE, 0, Resource.String.menu_delete); }
private ShellContextMenuHelper(IWin32Window owner, IContextMenu contextMenu, ContextMenuOptions options, EventHandler<ExecuteVerbEventArgs> onExecuteVerb) { this.ItemContainer = new Container(); this.OnExecuteVerb = null; this.Owner = owner; this.ContextMenu = contextMenu; this.Options = ((((options & ContextMenuOptions.Explore) > 0) ? (CMF.CMF_NORMAL | CMF.CMF_EXPLORE) : CMF.CMF_NORMAL) | (((options & ContextMenuOptions.CanRename) > 0) ? CMF.CMF_CANRENAME : CMF.CMF_NORMAL)) | (((options & ContextMenuOptions.VerbsOnly) > 0) ? (CMF.CMF_NORMAL | CMF.CMF_VERBSONLY) : CMF.CMF_NORMAL); this.OnExecuteVerb = onExecuteVerb; }
public override void OnCreateContextMenu (IContextMenu menu, View view, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu (menu, view, menuInfo); AdapterView.AdapterContextMenuInfo info =(AdapterView.AdapterContextMenuInfo) menuInfo; Tunnel.Client client = listAdapter[info.Position]; menu.SetHeaderTitle("Client " + client.ID+" at " + client.Address); menu.Add(Menu.None,0,0,"Throw off"); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { if (v.Id == Resource.Id.accountList) { menu.SetHeaderTitle(Strings.SelectOperationLabel); menu.Add(Strings.EditLabel); menu.Add(Strings.DeleteLabel); } }
/// <summary> /// Initializes a new instance of the <see cref="ProjectExplorerItem" /> class. /// </summary> /// <param name="itemValue">The itemValue rappresented by this item.</param> /// <param name="contextMenu">The context menu.</param> public ProjectExplorerItem(object itemValue, IContextMenu contextMenu) { Check.IfIsNull(itemValue).Throw<ArgumentNullException>(() => itemValue); this.itemValue = itemValue; var ctxMenuItems = contextMenu == null ? new List<IMenuItem>() : contextMenu.Items; contextMenuItems = new ObservableCollection<IMenuItem>(ctxMenuItems); children = new ObservableCollection<IProjectExplorerItem>(); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); m_EditTaskPosition = ((AdapterView.AdapterContextMenuInfo)menuInfo).Position; menu.SetHeaderTitle(m_AllTasks[m_EditTaskPosition].Task); MenuInflater.Inflate(Resource.Menu.ContextMenuHistoryTask, menu); }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); if (v == _text) { MenuInflater.Inflate(Resource.Menu.context_menu, menu); menu.SetHeaderTitle(new Java.Lang.String("Favorite browser?")); } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); var info = (AdapterView.AdapterContextMenuInfo)menuInfo; var id = (int)info.Id; menu.SetHeaderTitle("Options".ToJ()); menu.Add(0, id, 1, "Rename".ToJ()); menu.Add(0, id, 2, "Delete".ToJ()); }
public static string GetCommandString(IContextMenu iContextMenu, uint idcmd, bool executeString) { string command = GetCommandStringW(iContextMenu, idcmd, executeString); if (string.IsNullOrEmpty(command)) { command = GetCommandStringA(iContextMenu, idcmd, executeString); } return command; }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { if (v.Id == RollifyAndroid.Resource.Id.formulaListView) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo)menuInfo; menu.SetHeaderTitle (formulaAdapter [info.Position].Name); String[] menuItems = {"Use", "Edit", "Delete" }; for (int i = 0; i < menuItems.Length; i++) { menu.Add (Menu.None, i, i, menuItems [i]); } } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); if (v.Id != ListView.Id) return; var menuItems = Resources.GetStringArray(Resource.Array.HistoryItemContextMenu); for (var i = 0; i < menuItems.Length; i++) { menu.Add(Menu.None, i, Menu.None, menuItems[i]); } }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { if (v.Id != Resource.Id.MyFriendsListView) return; info = (AdapterView.AdapterContextMenuInfo)menuInfo; menu.SetHeaderTitle(Resource.String.ContextMenuTitle); var menuItems = Resources.GetStringArray(Resource.Array.ContextMenu); for (var i = 0; i < menuItems.Length; i++) { menu.Add(Menu.None, i, i, menuItems[i]); } }
private static bool GetContextMenuInterfaces(IShellFolder oParentFolder, IntPtr PIDLs, out IntPtr ctxMenuPtr) { var arrPidLs = new IntPtr[1]; arrPidLs[0] = PIDLs; var nResult = oParentFolder.GetUIObjectOf(IntPtr.Zero, (uint) arrPidLs.Length, arrPidLs, ref _iidIContextMenu, IntPtr.Zero, out ctxMenuPtr); if (SOk == nResult) { _oContextMenu = (IContextMenu) Marshal.GetTypedObjectForIUnknown(ctxMenuPtr, typeof (IContextMenu)); return true; } ctxMenuPtr = IntPtr.Zero; _oContextMenu = null; return false; }
public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo) { base.OnCreateContextMenu(menu, v, menuInfo); var info = (AdapterView.AdapterContextMenuInfo)menuInfo; var tag = info.TargetView.Tag; if (tag == null) return; var selectedPositionId = int.Parse(tag.ToString()); menu.SetHeaderTitle("Options".ToJ()); foreach (var contextItem in _presenter.GetContextItems()) { menu.Add(0, selectedPositionId, contextItem.Order, contextItem.Title.ToJ()); } }
private void ContextMenuStrip_Disposed(object sender, EventArgs e) { if (this.Menu != IntPtr.Zero) { Windows.DestroyMenu(this.Menu); } this.Menu = IntPtr.Zero; if (this.ContextMenu != null) { Marshal.ReleaseComObject(this.ContextMenu); } this.ContextMenu = null; this.ContextMenu2 = null; this.ContextMenu3 = null; this.Owner = null; ((Control) sender).Tag = null; }
public static void DisableMenuItems(IntPtr menu, IContextMenu contextMenu, string[] disabledCommands, DisabledMethods method) { if (disabledCommands == null || disabledCommands.Length == 0) return; foreach (int cmdID in GetMenuItemID(menu, contextMenu, disabledCommands, MenuIDTypes.CommadID)) if (cmdID != -1) switch (method) { case DisabledMethods.Remove: ShellAPI.RemoveMenu(menu, (uint)cmdID, ShellAPI.MFT.BYCOMMAND); break; case DisabledMethods.Gray: ShellAPI.EnableMenuItem(menu, (uint)cmdID, ShellAPI.MF_GRAYED); break; case DisabledMethods.Disable: ShellAPI.EnableMenuItem(menu, (uint)cmdID, ShellAPI.MF_DISABLED); break; } }
private void InvokeCommand(IContextMenu oContextMenu, uint nCmd, string strFolder, Point pointInvoke) { CMINVOKECOMMANDINFOEX invoke = new CMINVOKECOMMANDINFOEX(); invoke.cbSize = cbInvokeCommand; invoke.lpVerb = (IntPtr)(nCmd - CMD_FIRST); invoke.lpDirectory = strFolder; invoke.lpVerbW = (IntPtr)(nCmd - CMD_FIRST); invoke.lpDirectoryW = strFolder; invoke.fMask = CMIC.UNICODE | CMIC.PTINVOKE | ((Control.ModifierKeys & Keys.Control) != 0 ? CMIC.CONTROL_DOWN : 0) | ((Control.ModifierKeys & Keys.Shift) != 0 ? CMIC.SHIFT_DOWN : 0); invoke.ptInvoke = new POINT(pointInvoke.X, pointInvoke.Y); invoke.nShow = SW.SHOWNORMAL; oContextMenu.InvokeCommand(ref invoke); }
void Initialize(IListItemEx item) { Guid iise = typeof(IShellExtInit).GUID; var ishellViewPtr = (item.IsDrive || !item.IsFileSystem || item.IsNetworkPath) ? item.GetIShellFolder().CreateViewObject(IntPtr.Zero, typeof(IShellView).GUID) : item.Parent.GetIShellFolder().CreateViewObject(IntPtr.Zero, typeof(IShellView).GUID); var view = Marshal.GetObjectForIUnknown(ishellViewPtr) as IShellView; view?.GetItemObject(SVGIO.SVGIO_BACKGROUND, typeof(IContextMenu).GUID, out _Result); if (view != null) { Marshal.ReleaseComObject(view); } m_ComInterface = (IContextMenu)Marshal.GetTypedObjectForIUnknown(_Result, typeof(IContextMenu)); m_ComInterface2 = m_ComInterface as IContextMenu2; m_ComInterface3 = m_ComInterface as IContextMenu3; IntPtr iShellExtInitPtr; if (Marshal.QueryInterface(_Result, ref iise, out iShellExtInitPtr) == (int)HResult.S_OK) { var iShellExtInit = Marshal.GetTypedObjectForIUnknown(iShellExtInitPtr, typeof(IShellExtInit)) as IShellExtInit; try { var hhh = IntPtr.Zero; iShellExtInit?.Initialize(_ShellView.CurrentFolder.PIDL, null, 0); if (iShellExtInit != null) { Marshal.ReleaseComObject(iShellExtInit); } Marshal.Release(iShellExtInitPtr); } catch { } } m_MessageWindow = new MessageWindow(this); }