public MapListener(IAppContext context, ShapeEditor plugin, ContextMenuPresenter contextMenuPresenter, IBroadcasterService broadcaster) { if (context == null) { throw new ArgumentNullException("context"); } if (contextMenuPresenter == null) { throw new ArgumentNullException("contextMenuPresenter"); } if (broadcaster == null) { throw new ArgumentNullException("broadcaster"); } _context = context; _contextMenuPresenter = contextMenuPresenter; _broadcaster = broadcaster; plugin.ChooseLayer += OnChooseLayer; plugin.MouseUp += OnMapMouseUp; plugin.BeforeDeleteShape += OnBeforeDeleteShape; plugin.AfterShapeEdit += OnAfterShapeEdit; plugin.ShapeValidationFailed += OnShapeValidationFailed; }
// TODO: Move presenter out of the system // TODO: Separate the rest of the UI from the logic public override void Initialize() { base.Initialize(); SubscribeNetworkEvent <VerbSystemMessages.VerbsResponseMessage>(FillEntityPopup); SubscribeNetworkEvent <PlayerContainerVisibilityMessage>(HandleContainerVisibilityMessage); _contextMenuPresenter = new ContextMenuPresenter(this); SubscribeLocalEvent <MoveEvent>(_contextMenuPresenter.HandleMoveEvent); CommandBinds.Builder .Bind(ContentKeyFunctions.OpenContextMenu, new PointerInputCmdHandler(HandleOpenContextMenu)) .Register <VerbSystem>(); }
public MapListener(IAppContext context, IBroadcasterService broadcaster, ILayerService layerService, ContextMenuPresenter contextMenuPresenter, IProjectService projectService) { _context = context ?? throw new ArgumentNullException(nameof(context)); _broadcaster = broadcaster ?? throw new ArgumentNullException(nameof(broadcaster)); _layerService = layerService ?? throw new ArgumentNullException(nameof(layerService)); _contextMenuPresenter = contextMenuPresenter ?? throw new ArgumentNullException(nameof(contextMenuPresenter)); _projectService = projectService ?? throw new ArgumentNullException(nameof(projectService)); _map = _context.Map as IMap; if (_map == null) { throw new ApplicationException("Invalid map state."); } RegisterEvents(); }