Example #1
0
        public CommandsActionsAdapter(IServiceProvider serviceProvider, ActionsPaneItemCollection actions, CommandCollection commands, bool showGroupsAsRegions, IExchangeSnapIn snapIn, ExchangeFormView view, bool createActionsAtBottom)
        {
            this.snapIn                = snapIn;
            this.serviceProvider       = serviceProvider;
            this.actions               = actions;
            this.commands              = commands;
            this.adapters              = new List <CommandActionAdapter>(commands.Count);
            this.showGroupsAsRegions   = showGroupsAsRegions;
            this.createActionsAtBottom = createActionsAtBottom;
            this.view = view;
            this.commands.CommandAdded   += new CommandEventHandler(this.commands_CommandAdded);
            this.commands.CommandRemoved += new CommandEventHandler(this.commands_CommandRemoved);
            ActionsPaneItemCollection actionsPaneItemCollection = new ActionsPaneItemCollection();

            for (int i = 0; i < this.commands.Count; i++)
            {
                CommandActionAdapter commandActionAdapter = this.CreateAdapter(this.commands[i]);
                this.adapters.Add(commandActionAdapter);
                if (commandActionAdapter.Command.Visible)
                {
                    actionsPaneItemCollection.Add(commandActionAdapter.ActionItem);
                }
            }
            this.actions.AddRange(actionsPaneItemCollection.ToArray());
        }
Example #2
0
 private void DisposeAdapter(CommandActionAdapter adapter)
 {
     adapter.Command.EnabledChanged -= this.DelayUpdates;
     adapter.Command.VisibleChanged -= this.Command_VisibleChanged;
     adapter.Dispose();
 }