public void RemoveCommandGroup(CommandGroupViewModel group)
 {
     if (commandGroupsList.Contains(group))
     {
         commandGroupsList.Remove(group);
     }
 }
예제 #2
0
        private void CreateCommands()
        {
            List <CommandViewModel> list = new List <CommandViewModel>();

            RelayCommand clearRelay =
                new RelayCommand(
                    param => logSystem.ClearMessages(),
                    param => logSystem.Messages.Count > 0);
            CommandViewModel clearCvm =
                new CommandViewModel("Clear log", clearRelay);

            list.Add(clearCvm);

            RelayCommand copyClipBoardRelay =
                new RelayCommand(
                    param => logSystem.CopyToClipboard(),
                    param => logSystem.Messages.Count > 0);
            CommandViewModel copyClipboardCvm =
                new CommandViewModel("Copy to clipboard", copyClipBoardRelay);

            list.Add(copyClipboardCvm);

            List <CommandGroupViewModel> commandGroupsList = new List <CommandGroupViewModel>();
            CommandGroupViewModel        group             = new CommandGroupViewModel("Actions");

            foreach (CommandViewModel item in list)
            {
                group.Commands.Add(item);
            }
            commandGroupsList.Add(group);

            CommandGroups = new ReadOnlyCollection <CommandGroupViewModel>(commandGroupsList);
        }
 public void AddCommandGroup(CommandGroupViewModel group)
 {
     if (!commandGroupsList.Contains(group))
     {
         commandGroupsList.Add(group);
     }
 }