// The user selected a file from the menu. private void File_Click(object sender, EventArgs e) { // Don't bother if no one wants to catch the event. if (FileSelected != null) { // Get the corresponding FileInfo object. RibbonOrbRecentItem menu_item = sender as RibbonOrbRecentItem; FileInfo file_info = menu_item.Tag as FileInfo; // Raise the event. FileSelected(file_info.FullName); } }
// Constructor. public MruLoader(string application_name, RibbonOrbDropDown menu, int num_files) { ApplicationName = application_name; MyMenu = menu; NumFiles = num_files; FileInfos = new List <FileInfo>(); MenuItems = new RibbonOrbRecentItem[NumFiles + 1]; for (int i = 0; i < NumFiles; i++) { MenuItems[i] = new RibbonOrbRecentItem(); MenuItems[i].Visible = false; MyMenu.RecentItems.Add(MenuItems[i]); } // Reload items from the registry. LoadFiles(); // Display the items. ShowFiles(); }