Category / Section
How to remove the selected cube from cube selector in OlapClient Silverlight.
1 min read
We can remove the particular cube from the cube selector. This can be achieved by using the GetCubes() method from service class file and also from the sample level using the CubeInfoCollectionChanged event.
Using Service class:
C#
public CubeInfoCollection GetCubes() { CubeInfoCollection cubes = _dataManager.GetCubes(); if (cubes.Select(i => i).Where(j => j.Name == "Direct Sales").Count() > 0) { var selectedMembers2 = cubes.Select(i => i).Where(j => j.Name != "Direct Sales").ToList<CubeInfo>(); cubes.Clear(); foreach (var item in selectedMembers2) { cubes.Add(item); } } _dataManager.DataProvider.CloseConnection(); return cubes; }
Using Client side:
C#
public MainPage() { InitializeComponent(); this.OlapClient.OlapDataManager.CubeInfoCollectionChanged += OlapDataManager_CubeInfoCollectionChanged; } void OlapDataManager_CubeInfoCollectionChanged(object sender, CubeInfoCollectionChangedEventArgs e) { CubeInfoCollection cubes = e.NewCubes; if (cubes.Select(i => i).Where(j => j.Name == "Direct Sales").Count() > 0) { var selectedMembers2 = e.NewCubes.Select(i => i).Where(j => j.Name != "Direct Sales").ToList<CubeInfo>(); e.NewCubes.Clear(); foreach (var item in selectedMembers2) { e.NewCubes.Add(item); } } }