private List<MaterialObject> HighlightMaterialByTexture(TextureObject texture, Color c) { List<MaterialObject> highlighted = new List<MaterialObject>(); foreach (var item in MaterialGrid.Items) { MaterialObject mo = item as MaterialObject; if (mo != null && texture.RefList.Contains(mo.InstID)) { DataGridUtil.MarkAsHighlighted(MaterialGrid, item, c); highlighted.Add(mo); } } return highlighted; }
public bool NetHandle_FrameData_Texture(eNetCmd cmd, UsCmd c) { UsLogging.Printf("eNetCmd.Handle_FrameData_Texture received ({0}).", c.Buffer.Length); var textures = new ObservableCollection<TextureObject>(); int count = c.ReadInt32(); for (int i = 0; i < count; i++) { var m = new TextureObject(); m.InstID = c.ReadInt32(); m.Name = c.ReadString(); m.PixelSize = c.ReadString(); m.MemSize = c.ReadString(); m.RefCnt = c.ReadInt32(); m.RefList = new List<int>(); for (int k = 0; k < m.RefCnt; k++) { int owner = c.ReadInt32(); m.RefList.Add(owner); } textures.Add(m); } TextureGrid.Dispatcher.Invoke(new Action(() => { title_texture.Text = string.Format("Textures ({0})", textures.Count); TextureGrid.DataContext = textures; })); return true; }