// Create a new tile for this row using common base
        public MetroTile AddTile(TileType type, TileWidth width, TileHeight height, string bgColor, string title, string onClick = "", string navUrl = "")
        {
            // Get the last tile added to this row
            MetroTile lastTileAdded = this.Tiles.LastOrDefault();
            int nextLeftMargin = 0;

            // If this is the first tile in the row, margin is column margin
            if (lastTileAdded == null)
            {
                nextLeftMargin = this.Column.LeftMargin;
            }
            else
            {
                // Calculate left margin based on the previous tile in the row
                nextLeftMargin = lastTileAdded.LeftMargin + lastTileAdded.Width + Column.SpacingBetweenTiles;
            }

            // Now create the actual tile based on our calculations
            MetroTile newTile = new MetroTile(this.Column.Position, type, TopMargin, nextLeftMargin, width, height, bgColor, title, onClick, navUrl);

            // Add the new tile to the list of tiles for this row
            this.Tiles.Add(newTile);

            // Recalculate the width and height of this row
            this.Width = this.Width == 0 ? newTile.Width : this.Width + Column.SpacingBetweenTiles + newTile.Width;
            this.Height = this.Height < newTile.Height ? newTile.Height : this.Height;

            // Return the new tile so it can be further worked with
            return newTile;
        }
Example #2
0
        // Create a new tile for this row using common base
        public MetroTile AddTile(TileType type, TileWidth width, TileHeight height, string bgColor, string title, string onClick = "", string navUrl = "")
        {
            // Get the last tile added to this row
            MetroTile lastTileAdded  = this.Tiles.LastOrDefault();
            int       nextLeftMargin = 0;

            // If this is the first tile in the row, margin is column margin
            if (lastTileAdded == null)
            {
                nextLeftMargin = this.Column.LeftMargin;
            }
            else
            {
                // Calculate left margin based on the previous tile in the row
                nextLeftMargin = lastTileAdded.LeftMargin + lastTileAdded.Width + Column.SpacingBetweenTiles;
            }

            // Now create the actual tile based on our calculations
            MetroTile newTile = new MetroTile(this.Column.Position, type, TopMargin, nextLeftMargin, width, height, bgColor, title, onClick, navUrl);

            // Add the new tile to the list of tiles for this row
            this.Tiles.Add(newTile);

            // Recalculate the width and height of this row
            this.Width  = this.Width == 0 ? newTile.Width : this.Width + Column.SpacingBetweenTiles + newTile.Width;
            this.Height = this.Height < newTile.Height ? newTile.Height : this.Height;

            // Return the new tile so it can be further worked with
            return(newTile);
        }
Example #3
0
 private void NewMapDialog_Load(object sender, EventArgs e)
 {
     //Init textboxes
     textBoxRows.Text       = Rows.ToString();
     textBoxColumns.Text    = Cols.ToString();
     textBoxTileWidth.Text  = TileWidth.ToString();
     textBoxTileHeight.Text = TileHeight.ToString();
     UpdateLblMapSize();
 }
 // Initialize our tile, basic common settings
 // To make it more flexible, all other specialized properties are set on specific properties
 public MetroTile(int column, TileType tileType, int topMargin, int leftMargin, TileWidth width,
     TileHeight height, string bgColor, string title, string onClick = "", string navUrl = "")
 {
     this.LeftMargin = leftMargin;
     this.TopMargin = topMargin;
     this.Width = (int) width;
     this.Height = (int) height;
     this.BgColor = bgColor;
     this.OnClick = onClick;
     this.Column = column;
     this.TileType = tileType;
     this.Title = title;
     this.NavUrl = navUrl;
     this.id = (this.Column + "_" + this.TopMargin + "-" + this.LeftMargin).ToString();
 }
Example #5
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Id.Length != 0)
        {
            hash ^= Id.GetHashCode();
        }
        hash ^= tiles_.GetHashCode();
        if (master_ != null)
        {
            hash ^= Master.GetHashCode();
        }
        if (Random != false)
        {
            hash ^= Random.GetHashCode();
        }
        if (TileWidth != 0)
        {
            hash ^= TileWidth.GetHashCode();
        }
        if (TileHeight != 0)
        {
            hash ^= TileHeight.GetHashCode();
        }
        if (ColourBlended != false)
        {
            hash ^= ColourBlended.GetHashCode();
        }
        if (Enhanced != false)
        {
            hash ^= Enhanced.GetHashCode();
        }
        if (EnhancedThreshold != 0)
        {
            hash ^= EnhancedThreshold.GetHashCode();
        }
        if (EdgeDetection != false)
        {
            hash ^= EdgeDetection.GetHashCode();
        }
        hash ^= edges_.GetHashCode();
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
 // Initialize our tile, basic common settings
 // To make it more flexible, all other specialized properties are set on specific properties
 public MetroTile(int column, TileType tileType, int topMargin, int leftMargin, TileWidth width,
                  TileHeight height, string bgColor, string title, string onClick = "", string navUrl = "")
 {
     this.LeftMargin = leftMargin;
     this.TopMargin  = topMargin;
     this.Width      = (int)width;
     this.Height     = (int)height;
     this.BgColor    = bgColor;
     this.OnClick    = onClick;
     this.Column     = column;
     this.TileType   = tileType;
     this.Title      = title;
     this.NavUrl     = navUrl;
     this.id         = (this.Column + "_" + this.TopMargin + "-" + this.LeftMargin).ToString();
 }
Example #7
0
 protected void CheckTileFail(Tile tile)
 {
     if (!CheckTile(tile))
     {
         throw new ArgumentException(String.Format("Tried to add tile with dimenions ({0}, {1}), layer expects tile dimensions ({2}, {3})",
                                                   new string[] { tile.Width.ToString(), tile.Height.ToString(), TileWidth.ToString(), TileHeight.ToString() }));
     }
 }