/// <summary>
        /// Default ctor
        /// </summary>
        protected ModuleItem(IModuleRef moduleRef, IModule module, bool contentsEditable, ItemContext context)
        {
            this.moduleRef = moduleRef;
            this.context   = context;
            this.module    = module;
            LayoutManager  = new StackLayoutManager {
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Padding             = new Padding(0)
            };

            // Build positioned entities layer
            positionedEntities = new PositionedItemContainer();
            positionedEntities.SelectedItems.Changed += (s, _) => SelectionChanged.Fire(this);
            if (contentsEditable)
            {
                var selectHandler = new ItemSelectMouseHandler(positionedEntities, positionedEntities.MouseHandler);
                var moveHandler   = new ItemMoveMouseHandler(positionedEntities, selectHandler);
                var resizeHandler = new ItemResizeMouseHandler(positionedEntities, moveHandler);
                positionedEntities.MouseHandler = resizeHandler;
            }
            Items.Add(positionedEntities, new LayoutConstraints(FillDirection.Both));

            // Build background
            ReloadBackgroundImage();
        }
Example #2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public ModuleRunItem(IRailwayState railwayState, IModuleRef moduleRef, IModule module, bool contentsEditable, ItemContext context)
     : base(moduleRef, module, contentsEditable, context)
 {
     this.contentsEditable = contentsEditable;
     // Add all items
     AddPositionedItems(railwayState, module, PositionedEntities);
 }
Example #3
0
        /// <summary>
        /// Default ctor
        /// </summary>
        public ModuleEditItem(IModuleRef moduleRef, IModule module, bool contentsEditable, bool railwayEditable, ItemContext context)
            : base(moduleRef, module, contentsEditable, context)
        {
            this.railwayEditable  = railwayEditable;
            this.contentsEditable = contentsEditable;

            // Add all items
            AddPositionedItems(module, PositionedEntities, contentsEditable, railwayEditable);

            // Record mouse handler
            MouseHandler = new ToolTipMouseHandler(MouseHandler);
        }
Example #4
0
        public override object Visit(IModuleRef entity, IPackage data)
        {
            IModule module;
            var     resolved = entity.TryResolve(out module);

            data.Railway.Modules.Remove(entity);
            if (resolved)
            {
                module.Accept(this, data);
            }
            return(null);
        }
 public override object Visit(IModuleRef entity, IRailway data)
 {
     data.Modules.Remove(entity);
     return(null);
 }
Example #6
0
 public virtual TReturn Visit(IModuleRef entity, TData data)
 {
     return(default(TReturn));
 }
 public override object Visit(IModuleRef entity, GridContext data)
 {
     return(new ModuleRefSettings(entity, data));
 }