Example #1
0
        public void ResetContextMenu()
        {
            contextMenuStrip.InvokeIfRequired(() =>
            {
                contextMenuStrip.Items.DisposeItems();
                contextMenuStrip.Items.Clear();

                ToolStripMenuItem deleteMenuItem = contextMenuStrip.AddItem <ToolStripMenuItem>(MENU_ITEM_DELETE);

                foreach (File file in Folder.Files)
                {
                    deleteMenuItem.AddItem <ToolStripMenuItem>(file.Name, DeleteMenuItem_Click, file);
                }

                contextMenuStrip.AddItem <ToolStripMenuItem>(MENU_ITEM_DELETE_ALL, DeleteAllMenuItem_Click);
            });
        }