private void TileList_DoubleClick(object sender, EventArgs e) { if (SelectedTile != null) { Library lib = Session.FindLibrary(SelectedTile); int index = lib.Tiles.IndexOf(SelectedTile); TileForm dlg = new TileForm(SelectedTile); if (dlg.ShowDialog() == DialogResult.OK) { lib.Tiles[index] = dlg.Tile; populate_tiles(); } } }
private void ImportBtn_Click(object sender, EventArgs e) { OpenFileDialog open_dlg = new OpenFileDialog(); open_dlg.Filter = Program.ImageFilter; if (open_dlg.ShowDialog() != DialogResult.OK) { return; } Image img = Image.FromFile(open_dlg.FileName); if (img == null) { return; } Tile tile = new Tile(); tile.Image = img; tile.Category = TileCategory.Map; TileForm tile_dlg = new TileForm(tile); if (tile_dlg.ShowDialog() != DialogResult.OK) { return; } Session.Project.Library.Tiles.Add(tile_dlg.Tile); TileData td = new TileData(); td.TileID = tile.ID; Map map = new Map(); map.Name = Tools.FileName.Name(open_dlg.FileName); map.Tiles.Add(td); Session.Project.Maps.Add(map); Session.Modified = true; MapBox.Items.Add(map); MapBox.SelectedItem = map; }
private void ImportBtn_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog() { Filter = Program.ImageFilter }; if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } Image image = Image.FromFile(openFileDialog.FileName); if (image == null) { return; } Tile tile = new Tile() { Image = image, Category = TileCategory.Map }; TileForm tileForm = new TileForm(tile); if (tileForm.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } Session.Project.Library.Tiles.Add(tileForm.Tile); TileData tileDatum = new TileData() { TileID = tile.ID }; Masterplan.Data.Map map = new Masterplan.Data.Map() { Name = FileName.Name(openFileDialog.FileName) }; map.Tiles.Add(tileDatum); Session.Project.Maps.Add(map); Session.Modified = true; this.MapBox.Items.Add(map); this.MapBox.SelectedItem = map; }
private void ToolsImportMap_Click(object sender, EventArgs e) { OpenFileDialog open_dlg = new OpenFileDialog(); open_dlg.Filter = Program.ImageFilter; if (open_dlg.ShowDialog() != DialogResult.OK) { return; } Image img = Image.FromFile(open_dlg.FileName); if (img == null) { return; } Tile tile = new Tile(); tile.Image = img; TileForm tile_dlg = new TileForm(tile); if (tile_dlg.ShowDialog() != DialogResult.OK) { return; } Session.Project.Library.Tiles.Add(tile_dlg.Tile); TileData td = new TileData(); td.TileID = tile.ID; fMap.Tiles.Add(td); MapView.MapChanged(); }