Equals() public method

public Equals ( object obj ) : bool
obj object
return bool
Exemplo n.º 1
0
        protected MenuCommand FindCommand(Guid guid, int id)
        {
            ArrayList list = this._commandGroups[guid] as ArrayList;

            if (list != null)
            {
                foreach (MenuCommand command in list)
                {
                    if (command.CommandID.ID == id)
                    {
                        return(command);
                    }
                }
            }
            this.EnsureVerbs();
            if (this._currentVerbs != null)
            {
                int iD = StandardCommands.VerbFirst.ID;
                foreach (DesignerVerb verb in this._currentVerbs)
                {
                    CommandID commandID = verb.CommandID;
                    if ((commandID.ID == id) && commandID.Guid.Equals(guid))
                    {
                        return(verb);
                    }
                    if ((iD == id) && commandID.Guid.Equals(guid))
                    {
                        return(verb);
                    }
                    if (commandID.Equals(StandardCommands.VerbFirst))
                    {
                        iD++;
                    }
                }
            }
            return(null);
        }
Exemplo n.º 2
0
        /// <summary>
        ///  Locates the requested command. This will throw an appropriate
        ///  ComFailException if the command couldn't be found.
        /// </summary>
        protected MenuCommand FindCommand(Guid guid, int id)
        {
            Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "MCS Searching for command: " + guid.ToString() + " : " + id.ToString(CultureInfo.CurrentCulture));

            // Search in the list of commands only if the command group is known
            ArrayList commands;

            lock (_commandGroupsLock)
            {
                _commandGroups.TryGetValue(guid, out commands);
            }

            if (commands != null)
            {
                Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group");
                foreach (MenuCommand command in commands)
                {
                    if (command.CommandID.ID == id)
                    {
                        Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t... MCS Found Command");
                        return(command);
                    }
                }
            }

            // Next, search the verb list as well.
            //
            EnsureVerbs();
            if (_currentVerbs != null)
            {
                int currentID = StandardCommands.VerbFirst.ID;
                foreach (DesignerVerb verb in _currentVerbs)
                {
                    CommandID cid = verb.CommandID;

                    if (cid.ID == id)
                    {
                        Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found verb");

                        if (cid.Guid.Equals(guid))
                        {
                            Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group");
                            return(verb);
                        }
                    }

                    // We assign virtual sequential IDs to verbs we get from the component. This allows users
                    // to not worry about assigning these IDs themselves.
                    //
                    if (currentID == id)
                    {
                        Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found verb");

                        if (cid.Guid.Equals(guid))
                        {
                            Debug.WriteLineIf(MENUSERVICE.TraceVerbose, "\t...MCS Found group");
                            return(verb);
                        }
                    }

                    if (cid.Equals(StandardCommands.VerbFirst))
                    {
                        currentID++;
                    }
                }
            }

            return(null);
        }