public static IDynamicCommandMenuContext CreateDynamicCommandMenuContext(DynamicCommandMenuOptions options, CommandManager commandManager, IContentSourceSite sourceSite)
 {
     return new ContentSourceCommandMenuContext(options, commandManager, sourceSite);
 }
예제 #2
0
        private void InitializeContentSources()
        {
            // create commands for the content-sources (used by the dynamic command menu and sidebar)
            CommandManager.BeginUpdate();
            // first built in
            foreach (ContentSourceInfo contentSourceInfo in ContentSourceManager.BuiltInInsertableContentSources)
                CommandManager.Add(new ContentSourceCommand(this, contentSourceInfo, true));

            // then plug ins
            UpdateContentSourceCommands();

            CommandManager.EndUpdate();

            // subscribe to changes in the list of content sources
            ContentSourceManager.GlobalContentSourceListChanged += new EventHandler(ContentSourceManager_GlobalContentSourceListChanged);

            // create a dynamic command menu for the content sources
            string basePath = new Command(CommandId.InsertPictureFromFile).MainMenuPath.Split('/')[0];

            DynamicCommandMenuOptions options = new DynamicCommandMenuOptions(basePath, 500, Res.Get(StringId.DynamicCommandMenuMore), Res.Get(StringId.DynamicCommandMenuInsert));
            options.UseNumericMnemonics = false;
            options.MaxCommandsShownOnMenu = 20;
            options.SeparatorBegin = true;
            IDynamicCommandMenuContext context = ContentSourceManager.CreateDynamicCommandMenuContext(options, CommandManager, this);
            DynamicCommandMenu contentSourceList = new DynamicCommandMenu(context);

            CommandContextMenuDefinition insertMenuDefinition = new CommandContextMenuDefinition();
            insertMenuDefinition.CommandBar = true;
            insertMenuDefinition.Entries.Add(CommandId.InsertLink, false, false);
            insertMenuDefinition.Entries.Add(CommandId.InsertPictureFromFile, false, false);
            insertMenuDefinition.Entries.Add(WebImageContentSource.ID, false, false);
            insertMenuDefinition.Entries.Add(CommandId.InsertTable2, true, true);

            foreach (string commandId in contentSourceList.CommandIdentifiers)
                if (WebImageContentSource.ID != commandId)
                    insertMenuDefinition.Entries.Add(commandId, false, false);
        }
 public ContentSourceCommandMenuContext(DynamicCommandMenuOptions options, CommandManager commandManager, IContentSourceSite sourceSite)
 {
     _options = options;
     _commandManager = commandManager;
     _insertionSite = sourceSite;
 }