public void SelectTexture(TextureItem item) { if (_freeze) { return; } if (item == null) { SelectedTexturesList.SetSelectedTextures(new TextureItem[0]); return; } UpdateRecentTextureList(); // If the texture is in the list of selected faces, select the texture in that list var sl = SelectedTexturesList.GetTextures(); if (sl.Any(x => String.Equals(x.Name, item.Name, StringComparison.InvariantCultureIgnoreCase))) { SelectedTexturesList.SetSelectedTextures(new[] { item }); SelectedTexturesList.ScrollToItem(item); } else if (RecentTexturesList.GetTextures().Contains(item)) { // Otherwise, select the texture in the recent list RecentTexturesList.SetSelectedTextures(new[] { item }); RecentTexturesList.ScrollToItem(item); } RecentTexturesList.Refresh(); SelectedTexturesList.Refresh(); }
public void SelectTexture(TextureItem item) { if (item == null) { SelectedTexturesList.SetSelectedTextures(new TextureItem[0]); return; } UpdateRecentTextureList(); // If the texture is in the list of selected faces, select the texture in that list var sl = SelectedTexturesList.GetTextures(); if (sl.Contains(item)) { SelectedTexturesList.SetSelectedTextures(new[] { item }); SelectedTexturesList.ScrollToItem(item); } else if (RecentTexturesList.GetTextures().Contains(item)) { // Otherwise, select the texture in the recent list RecentTexturesList.SetSelectedTextures(new[] { item }); RecentTexturesList.ScrollToItem(item); } RecentTexturesList.Refresh(); SelectedTexturesList.Refresh(); }