Example #1
0
// This function generates the initial menu tree for the IN and OUT buttons
// Later functions will dynamically add:
//   a) the OUT shortcut
//   b) the filter list
        private void generateAddMappingContextMenus()
        {
            var builder     = new MenuBuilder <CommandProxy>();
            var itemBuilder = new Func <CommandProxy, MenuItemViewModel>(p => new MenuItemViewModel
            {
                Text = p.Name,
                Tag  = p
            });

            var allIn = All.KnownInCommands.Select(kv => kv.Value);

            InCommands = new ObservableCollection <MenuItemViewModel>(builder.BuildTree(allIn, itemBuilder, a => a.Category.ToDescriptionString(), "->", false, false));

            var allOut = All.KnownOutCommands.Select(kv => kv.Value);

            OutCommands = new ObservableCollection <MenuItemViewModel>(builder.BuildTree(allOut, itemBuilder, a => a.Category.ToDescriptionString(), "->", false, false));

            // list versions for searching later
            InCommands_wholelist  = new ObservableCollection <MenuItemViewModel>(builder.BuildList(allIn, itemBuilder));
            OutCommands_wholelist = new ObservableCollection <MenuItemViewModel>(builder.BuildList(allOut, itemBuilder));


            InCommands.Add(_separator);
            InCommands.Add(_separator);
            OutCommands.Add(_separator);
            OutCommands.Add(_separator);

            // location of the dynamic components of the menu
            InCommands_dynamic_index  = InCommands.Count() - 2;
            OutCommands_dynamic_index = InCommands.Count() - 2;

            In_has_shortcut  = false;
            Out_has_shortcut = false;
        }
Example #2
0
 public List <MenuItemViewModel> BuildSelectedNotesMenu(IEnumerable <object> selectedNotes)
 {
     if (selectedNotes.First() is AMidiDefinition)
     {
         return(BuildProprietaryMenu(selectedNotes.Cast <AMidiDefinition>(), '.'));               //fixme: get right split char
     }
     return(_genericMenuBuilder.BuildList(selectedNotes.Cast <string>(), buildMenuItemSelected)); // , buildPath, ".", false);
 }