當前位置: 首頁>>代碼示例>>C#>>正文


C# List.AsReadOnly方法代碼示例

本文整理匯總了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();
        }
開發者ID:kweinberg1,項目名稱:SoundAtlas,代碼行數:18,代碼來源:MainWindow.xaml.cs

示例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();
            }
        }
開發者ID:kweinberg1,項目名稱:SoundAtlas,代碼行數:28,代碼來源:MainWindow.xaml.cs


注:本文中的Model.List.AsReadOnly方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。