KPFloatingPanel.MainForm.AddItemsToMenu C# (CSharp) Method

AddItemsToMenu() private method

private AddItemsToMenu ( ToolStripMenuItem Parent, PwGroup RootGroup ) : void
Parent ToolStripMenuItem
RootGroup PwGroup
return void
        private void AddItemsToMenu(ToolStripMenuItem Parent, PwGroup RootGroup)
        {
            //s² - 2009/06/21 - Sorting of PW-Entries in FloatingPanel
            List<PwEntry> myList = RootGroup.GetEntries(is_searching).CloneShallowToList();
            DateTime now = DateTime.Now;
            if (FOptions.sortAlphabetical) {
                myList.Sort((X, Y) => X.Strings.ReadSafe(PwDefs.TitleField).CompareTo(Y.Strings.ReadSafe(PwDefs.TitleField)));
            }
            //End s² - 2009/06/21 - Sorting of PW-Entries in FloatingPanel

            foreach (PwEntry Entry in myList) {
                ToolStripMenuItem Item = new ToolStripMenuItem();
                Item.Tag = Entry;
                Item.Text = Entry.Strings.ReadSafe(PwDefs.TitleField);
                Item.BackColor = Entry.BackgroundColor;
                Item.DropDownOpening += miItem_DropDownOpening;
                Item.DoubleClick += miItem_OpenURL;
                Item.DoubleClickEnabled = true;

                PwIcon IconIndex = Entry.IconId;
                PwUuid CustomIconID = Entry.CustomIconUuid;

                if (CustomIconID != PwUuid.Zero)
                    Item.Image = Host.Database.GetCustomIcon(CustomIconID);
                else
                    Item.Image = Host.MainWindow.ClientIcons.Images[(int)IconIndex];
                if (Item.Image == null)
                    Item.Image = ilIcons.Images[5];

                if (Entry.Expires){
                    if (Entry.ExpiryTime <= now)
                    {
                        Item.Image = ilIcons.Images[7];
                        Item.Font = new Font(Item.Font, Item.Font.Style | FontStyle.Strikeout);
                    }
                    Item.ToolTipText = KPRes.ExpiryTime + ": " + Entry.ExpiryTime;
                }

                if (Parent == null)
                    pmPasswords.Items.Add(Item);
                else
                    Parent.DropDownItems.Add(Item);

                ToolStripMenuItem Dummy = new ToolStripMenuItem();
                Dummy.Tag = null;
                Dummy.Text = "dummy";
                Dummy.Enabled = false;
                Item.DropDownItems.Add(Dummy);
            }
        }