public IMosaicItem AddNeighbor(IMosaicItem neighbor, DirectionEnum direction) { if (GetNeighbor(direction) != null) { return(null); } switch (direction) { case DirectionEnum.Up: NeighborTop = neighbor; break; case DirectionEnum.Right: NeighborRight = neighbor; break; case DirectionEnum.Down: NeighborBottom = neighbor; break; case DirectionEnum.Left: NeighborLeft = neighbor; break; default: return(null); } return(neighbor); }
public IMosaicItem GetItem(string screenId) { IMosaicItem itemResult = null; foreach (var item in Items) { if (item.Screen.Id.ToString() == screenId) { itemResult = item; break; } } return(itemResult); }
public IMosaicItem GetItem(Screen screen) { IMosaicItem itemResult = null; foreach (var item in Items) { if (item.Screen.Id == screen.Id) { itemResult = item; break; } } return(itemResult); }
public void NodeMaker(IMosaicItem item) { int width = item.Screen.Dimension.Width; int height = item.Screen.Dimension.Height; //Top var dimensionTop = item.DimensionTop(includeMe: false); height += dimensionTop.Height; if (dimensionTop.Width > width) { width = dimensionTop.Width; } //Right var dimensionRight = item.DimensionRight(includeMe: false); width += dimensionRight.Width; if (dimensionRight.Height > height) { height = dimensionRight.Height; } //Bottom var dimensionBottom = item.DimensionBottom(includeMe: false); height += dimensionBottom.Height; if (dimensionBottom.Width > width) { width = dimensionBottom.Width; } //Left var dimensionLeft = item.DimensionLeft(includeMe: false); width += dimensionLeft.Width; if (dimensionLeft.Height > height) { height = dimensionLeft.Height; } _dimension.Width = width; _dimension.Height = height; }