コード例 #1
0
ファイル: Helper.cs プロジェクト: turky-9/yu
        /// <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 codinates) 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);
        }
コード例 #2
0
 public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
 {
     menu.Add("One");
     menu.Add("Two");
     menu.Add("Three");
     menu.Add("Four");
 }
コード例 #3
0
ファイル: SearchResults.cs プロジェクト: pythe/wristpass
        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);
        }
コード例 #4
0
        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;
            }
        }
コード例 #5
0
        public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
        {
            base.OnCreateContextMenu(menu, v, menuInfo);

            menu.Add("Up");
            menu.Add("Down");
        }
コード例 #6
0
        /// <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;
        }
コード例 #7
0
        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]);
                }
            }
        }
コード例 #8
0
        /// <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);
            }
        }
コード例 #9
0
        /// <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;
        }
コード例 #10
0
        /// <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;
        }
コード例 #11
0
        /// <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;
        }
コード例 #12
0
ファイル: ShellContextMenu.cs プロジェクト: tysmithnet/panda
 /// <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;
     }
 }
コード例 #13
0
            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");
            }
コード例 #14
0
 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, "Удалить");
 }
コード例 #15
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.
            }
        }
コード例 #16
0
        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");
        }
コード例 #17
0
        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);
            }
        }
コード例 #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 = 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());
            }
        }
コード例 #19
0
        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;
                    }
                }
            }
        }
コード例 #20
0
ファイル: Fragment1.cs プロジェクト: shakizat/Mono
        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);
        }
コード例 #21
0
        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);
        }
コード例 #22
0
ファイル: Game.cs プロジェクト: medvedbeast/Warlocks
 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());
 }
コード例 #23
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);

                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());
            }
        }
コード例 #24
0
 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");
 }
コード例 #25
0
 public void Init(PluginInitContext context)
 {
     Context     = context;
     viewModel   = new SettingsViewModel(context);
     Settings    = viewModel.Settings;
     contextMenu = new ContextMenu(Context, Settings);
 }
コード例 #26
0
 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);
         }
     }
 }
コード例 #27
0
        public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
        {
            var info    = (AdapterView.AdapterContextMenuInfo)menuInfo;
            var contact = _adapter[info.Position];

            _menuManager.CreateMenu(menu, contact);
        }
コード例 #28
0
 public void Init(PluginInitContext context)
 {
     _context           = context;
     _contextMenuLoader = new ContextMenuLoader(context);
     InitialDriverList();
     LoadEnvironmentStringPaths();
 }
コード例 #29
0
        /// <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);
        }
コード例 #30
0
ファイル: ContextMenus.cs プロジェクト: adbk/spikes
		public override void OnCreateContextMenu (IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
		{
			menu.Add ("One");
			menu.Add ("Two");
			menu.Add ("Three");
			menu.Add ("Four");
		}
コード例 #31
0
        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);
        }
コード例 #32
0
            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");
            }
コード例 #33
0
 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, "Удалить");
 }
コード例 #34
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);
                    }
                }
            }
        }
コード例 #35
0
        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);
        }
コード例 #36
0
        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);
                }
            }
        }
コード例 #37
0
ファイル: Main.cs プロジェクト: solitudechn/Flow.Launcher
        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);
        }
コード例 #38
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
                });
            }
        }
コード例 #39
0
        /// <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);
        }
コード例 #40
0
 void View.IOnCreateContextMenuListener.OnCreateContextMenu(IContextMenu menu, View v,
                                                            IContextMenuContextMenuInfo menuInfo)
 {
     if (OnCreateContextMenu != null)
     {
         OnCreateContextMenu(menu, v, menuInfo);
     }
 }
コード例 #41
0
 public BeforePopupEventArgs(IntPtr ptrPopupMenu, IContextMenu iContextMenu, uint defaultCommandID, string defaultCommand)
 {
     this.ptrPopupMenu = ptrPopupMenu;
     this.iContextMenu = iContextMenu;
     ContinuePopup = true;
     DefaultCommandID = defaultCommandID;
     DefaultCommand = defaultCommand;
 }
コード例 #42
0
		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);
		}
コード例 #43
0
 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;
 }
コード例 #44
0
		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");

		}
コード例 #45
0
 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);
     }
 }
コード例 #46
0
        /// <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>();
        }
コード例 #47
0
        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);
        }
コード例 #48
0
        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?"));
            }
        }
コード例 #49
0
        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());
        }
コード例 #50
0
        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;
        }
コード例 #51
0
 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]);
         }
     }
 }
コード例 #52
0
		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]);
			}
		}
コード例 #53
0
        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]);
            }
        }
コード例 #54
0
        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;
        }
コード例 #55
0
        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());
            }
        }
コード例 #56
0
 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;
 }
コード例 #57
0
        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;
                    }
        }
コード例 #58
0
ファイル: ShellContextMenu.cs プロジェクト: xanthalas/Rummage
 /// <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;
     }
 }
コード例 #59
0
ファイル: ShellContextMenu.cs プロジェクト: xanthalas/Rummage
        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);
        }
コード例 #60
-1
        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);
        }