本文整理匯總了C#中Model.List.AsReadOnly方法的典型用法代碼示例。如果您正苦於以下問題:C# List.AsReadOnly方法的具體用法?C# List.AsReadOnly怎麽用?C# List.AsReadOnly使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Model.List
的用法示例。
在下文中一共展示了List.AsReadOnly方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: OnSearchControlPopupClosed
/// <summary>
/// Event handler when the search popup is closed. Adds the artist to the atlas
/// if there a valid selection.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnSearchControlPopupClosed(object sender, EventArgs e)
{
Artist selectedArtist = this.SearchControlPopup.SelectedItem;
if (selectedArtist == null)
return;
List<Artist> artistList = new List<Artist>() { selectedArtist };
AtlasViewOptions options = new AtlasViewOptions(1);
this.AtlasView.ViewModel.AddArtistsToHierarchy(artistList.AsReadOnly(), options);
this.AtlasView.UpdateNetwork();
}
示例2: OnRecommend
private void OnRecommend(object sender, RoutedEventArgs e)
{
Playlist selectedPlaylist = (Playlist)this.NavigationControl.ViewModel.SelectedPlaylist;
if (selectedPlaylist == null)
return;
RecommendationEngine engine = new RecommendationEngine();
Artist recommendedArtist = engine.Recommend(SpotifyClientService.Client, selectedPlaylist);
RecommendationWindow recommendationWindow = new RecommendationWindow(recommendedArtist);
bool? result = recommendationWindow.ShowDialog();
if (result != null && result.Value == true)
{
ArtistNetworkNodeViewModel targetNodeViewModel = this.AtlasView.ViewModel.FindNode<ArtistNetworkNodeViewModel>(recommendedArtist.ID);
if (targetNodeViewModel == null) {
List<Artist> recommendedArtistList = new List<Artist>() {recommendedArtist};
AtlasViewOptions options = new AtlasViewOptions(1);
this.AtlasView.ViewModel.AddArtistsToHierarchy(recommendedArtistList.AsReadOnly(), options);
this.AtlasView.UpdateNetwork();
targetNodeViewModel = this.AtlasView.ViewModel.FindNode<ArtistNetworkNodeViewModel>(recommendedArtist.ID);
}
targetNodeViewModel.AddTracks();
}
}