Пример #1
0
        /// <summary>
        /// Creates a new instance of <see cref="ContextMenuBuilder"/>.
        /// </summary>
        /// <param name="featureCommandHandler">The <see cref="IApplicationFeatureCommands"/> from which to obtain
        /// information to render and bind actions to the items of the <see cref="ContextMenu"/>.</param>
        /// <param name="importCommandHandler">The <see cref="IImportCommandHandler"/> from which to obtain
        /// information to render and bind actions to the items of the <see cref="ContextMenu"/>.</param>
        /// <param name="exportCommandHandler">The <see cref="IExportCommandHandler"/> from which to obtain
        /// information to render and bind actions to the items of the <see cref="ContextMenu"/>.</param>
        /// <param name="updateCommandHandler">The <see cref="IUpdateCommandHandler"/> from which to obtain
        /// information to render and bind actions to the items of the <see cref="ContextMenu"/>.</param>
        /// <param name="viewCommands">The <see cref="IViewCommands"/> from which to obtain information to render
        /// and bind actions to the items of the <see cref="ContextMenu"/>.</param>
        /// <param name="dataValue">The data object for which to create a <see cref="ContextMenuStrip"/>.</param>
        /// <param name="treeViewControl">The <see cref="TreeViewControl"/> to use while executing the <see cref="ContextMenuStrip"/> actions.</param>
        /// <exception cref="ContextMenuBuilderException">Thrown when any input argument is <c>null</c>.</exception>
        public ContextMenuBuilder(IApplicationFeatureCommands featureCommandHandler,
                                  IImportCommandHandler importCommandHandler,
                                  IExportCommandHandler exportCommandHandler,
                                  IUpdateCommandHandler updateCommandHandler,
                                  IViewCommands viewCommands, object dataValue,
                                  TreeViewControl treeViewControl)
        {
            try
            {
                guiItemsFactory = new GuiContextMenuItemFactory(featureCommandHandler,
                                                                importCommandHandler,
                                                                exportCommandHandler,
                                                                updateCommandHandler,
                                                                viewCommands,
                                                                dataValue);

                treeViewItemsFactory = new TreeViewContextMenuItemFactory(dataValue, treeViewControl);
            }
            catch (ArgumentNullException e)
            {
                throw new ContextMenuBuilderException(Resources.ContextMenuBuilder_ContextMenuBuilder_Cannot_create_instances_of_factories, e);
            }

            contextMenu = new ContextMenuStrip();
        }
Пример #2
0
 public UpdateCommandHandler(IRepository <TDomain, TId> repository, IValidationEngine validationEngine, IEnumerable <IPermision <TDomain> > permisionSet, IUpdateHandlerFactory <TUpdateCommand, TDomain> updaterFactory, IEnumerable <ICommandPermision <TUpdateCommand, TDomain> > commandPermisions, IEnumerable <ICommandAction <TUpdateCommand, TDomain> > preCommitActions)
 {
     _repository        = repository;
     _preCommitActions  = preCommitActions;
     _commandPermisions = commandPermisions;
     _updater           = updaterFactory.BuildUpdater();
     _permisionSet      = permisionSet;
     _validationEngine  = validationEngine;
 }
Пример #3
0
 public TodoTaskController(
     ILogger <TodoTaskController> logger,
     ICreateTodoTaskCommandHandler createTodoTaskHandler,
     IGetAllQueryHandler getAllHandler,
     IDeleteCommandHandler deleteHandler,
     IUpdateCommandHandler updateHandler)
 {
     this.logger = logger;
     this.createTodoTaskHandler = createTodoTaskHandler;
     this.getAllHandler         = getAllHandler;
     this.deleteHandler         = deleteHandler;
     this.updateHandler         = updateHandler;
 }
Пример #4
0
        /// <summary>
        /// Creates a new instance of <see cref="GuiContextMenuItemFactory"/>.
        /// </summary>
        /// <param name="applicationFeatureCommandHandler">The <see cref="IApplicationFeatureCommands"/>
        /// which contains information for creating the <see cref="ToolStripItem"/>.</param>
        /// <param name="importCommandHandler">The <see cref="IImportCommandHandler"/> which contains
        /// information for creating the <see cref="ToolStripItem"/>.</param>
        /// <param name="exportCommandHandler">The <see cref="IExportCommandHandler"/> which contains
        /// information for creating the <see cref="ToolStripItem"/>.</param>
        /// <param name="updateCommandHandler">The <see cref="IUpdateCommandHandler"/> which contains
        /// information for creating the <see cref="ToolStripItem"/>.</param>
        /// <param name="viewCommandsHandler">The <see cref="IViewCommands"/> which contains information for
        /// creating the <see cref="ToolStripItem"/>.</param>
        /// <param name="dataObject">The data object for which to create <see cref="ToolStripItem"/>.</param>
        /// <exception cref="ArgumentNullException">Thrown when any input argument is <c>null</c>.</exception>
        public GuiContextMenuItemFactory(IApplicationFeatureCommands applicationFeatureCommandHandler,
                                         IImportCommandHandler importCommandHandler,
                                         IExportCommandHandler exportCommandHandler,
                                         IUpdateCommandHandler updateCommandHandler,
                                         IViewCommands viewCommandsHandler,
                                         object dataObject)
        {
            if (applicationFeatureCommandHandler == null)
            {
                throw new ArgumentNullException(nameof(applicationFeatureCommandHandler),
                                                Resources.GuiContextMenuItemFactory_Can_not_create_gui_context_menu_items_without_gui);
            }

            if (importCommandHandler == null)
            {
                throw new ArgumentNullException(nameof(importCommandHandler),
                                                Resources.GuiContextMenuItemFactory_Can_not_create_gui_context_menu_items_without_import_handler);
            }

            if (exportCommandHandler == null)
            {
                throw new ArgumentNullException(nameof(exportCommandHandler),
                                                Resources.GuiContextMenuItemFactory_Can_not_create_gui_context_menu_items_without_export_handler);
            }

            if (updateCommandHandler == null)
            {
                throw new ArgumentNullException(nameof(updateCommandHandler),
                                                Resources.GuiContextMenuItemFactory_Can_not_create_gui_context_menu_items_without_update_handler);
            }

            if (viewCommandsHandler == null)
            {
                throw new ArgumentNullException(nameof(viewCommandsHandler),
                                                Resources.GuiContextMenuItemFactory_Can_not_create_gui_context_menu_items_without_view_commands);
            }

            if (dataObject == null)
            {
                throw new ArgumentNullException(nameof(dataObject),
                                                Resources.ContextMenuItemFactory_Can_not_create_context_menu_items_without_data);
            }

            this.applicationFeatureCommandHandler = applicationFeatureCommandHandler;
            this.importCommandHandler             = importCommandHandler;
            this.exportCommandHandler             = exportCommandHandler;
            this.updateCommandHandler             = updateCommandHandler;
            viewCommands    = viewCommandsHandler;
            this.dataObject = dataObject;
        }
Пример #5
0
 public SearchWorkerService(IQueryRepository queryRepository, IUpdateCommandHandler updateCommandHandler)
 {
     _queryRepository      = queryRepository;
     _updateCommandHandler = updateCommandHandler;
 }