private void FullEmptyCategoriesTxTChecked(IEnumerable <TileCategory> list, IEnumerable <ItemData> datalist, TileCategory tileCategory) { var style = new TileStyle(); foreach (ItemData itemData in datalist) { Tile tile = null; int number = itemData.Id; var tiles = from cat in list let t = cat.FindTile(number) where t != null select t; tile = tiles.FirstOrDefault(); if (tile == null) { string name = string.Format("{0}-{1}", tileCategory.Name, itemData.Name.Replace(tileCategory.Name, "").Split(separator2, StringSplitOptions . RemoveEmptyEntries) .FirstOrDefault()); if (string.IsNullOrEmpty(style.Name) || style.Name != name) { if (style.Tiles.Count > 0 && tileCategory.FindStyleByName(style.Name) == null) { tileCategory.AddStyle(style); } var st2 = tileCategory.FindStyleByName(name); if (st2 == null) { style = new TileStyle { Name = name } } ; else { style = st2; } } style.AddTile(new Tile() { Id = number, Name = itemData.Name }); } } tileCategory.AddStyle(style); }
private void ButtonAddTile_Click(object sender, RoutedEventArgs e) { var category = DataCategory.SelectedItem as TileCategory; var id = ListData.SelectedIndex; var style = DataStyle.SelectedItem as TileStyle; if(style == null) { style = new TileStyle(); category.AddStyle(style); } if (ComboEnum.SelectedItem == null) return; switch ((TilesInfo.Components.Enums.Type)ComboEnum.SelectedItem) { case Type.Wall: { var tile = new TileWall(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Roofs: { var tile = new TileRoof(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Floor: { var tile = new TileFloor(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Misc: { var tile = new TileMisc(); tile.Id = (short)id; style.AddTile(tile); break; } default: { var tile = new Tile(); tile.Id = (short)id; style.AddTile(tile); break; } } DataRefresh(); }
private void ButtonAddTile_Click(object sender, RoutedEventArgs e) { var category = DataCategory.SelectedItem as TileCategory; var id = ListData.SelectedIndex; var style = DataStyle.SelectedItem as TileStyle; if (style == null) { style = new TileStyle(); category.AddStyle(style); } if (ComboEnum.SelectedItem == null) { return; } switch ((TilesInfo.Components.Enums.Type)ComboEnum.SelectedItem) { case Type.Wall: { var tile = new TileWall(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Roofs: { var tile = new TileRoof(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Floor: { var tile = new TileFloor(); tile.Id = (short)id; style.AddTile(tile); break; } case Type.Misc: { var tile = new TileMisc(); tile.Id = (short)id; style.AddTile(tile); break; } default: { var tile = new Tile(); tile.Id = (short)id; style.AddTile(tile); break; } } DataRefresh(); }