本文整理汇总了C#中Result.SendResult方法的典型用法代码示例。如果您正苦于以下问题:C# Result.SendResult方法的具体用法?C# Result.SendResult怎么用?C# Result.SendResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Result
的用法示例。
在下文中一共展示了Result.SendResult方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadChildrenImpl
void LoadChildrenImpl (string parentId, Result result)
{
LogHelper.Debug (Tag, "OnLoadChildren: parentMediaId=", parentId);
var mediaItems = new JavaList<MediaBrowser.MediaItem> ();
if (MediaIDHelper.MediaIdRoot == parentId) {
LogHelper.Debug (Tag, "OnLoadChildren.ROOT");
mediaItems.Add (new MediaBrowser.MediaItem (
new MediaDescription.Builder ()
.SetMediaId (MediaIDHelper.MediaIdMusicsByGenre)
.SetTitle (GetString (Resource.String.browse_genres))
.SetIconUri (Android.Net.Uri.Parse ("android.resource://" +
"com.example.android.mediabrowserservice/drawable/ic_by_genre"))
.SetSubtitle (GetString (Resource.String.browse_genre_subtitle))
.Build (), MediaItemFlags.Browsable
));
} else if (MediaIDHelper.MediaIdMusicsByGenre == parentId) {
LogHelper.Debug (Tag, "OnLoadChildren.GENRES");
foreach (var genre in musicProvider.Genres) {
var item = new MediaBrowser.MediaItem (
new MediaDescription.Builder ()
.SetMediaId (MediaIDHelper.CreateBrowseCategoryMediaID (MediaIDHelper.MediaIdMusicsByGenre, genre))
.SetTitle (genre)
.SetSubtitle (GetString (Resource.String.browse_musics_by_genre_subtitle, genre))
.Build (), MediaItemFlags.Browsable
);
mediaItems.Add (item);
}
} else if (parentId.StartsWith (MediaIDHelper.MediaIdMusicsByGenre)) {
var genre = MediaIDHelper.GetHierarchy (parentId) [1];
LogHelper.Debug (Tag, "OnLoadChildren.SONGS_BY_GENRE genre=", genre);
foreach (var track in musicProvider.GetMusicsByGenre(genre)) {
var hierarchyAwareMediaID = MediaIDHelper.CreateMediaID (
track.Description.MediaId, MediaIDHelper.MediaIdMusicsByGenre, genre);
var trackCopy = new MediaMetadata.Builder (track)
.PutString (MediaMetadata.MetadataKeyMediaId, hierarchyAwareMediaID)
.Build ();
var bItem = new MediaBrowser.MediaItem (
trackCopy.Description, MediaItemFlags.Playable);
mediaItems.Add (bItem);
}
} else {
LogHelper.Warn (Tag, "Skipping unmatched parentMediaId: ", parentId);
}
LogHelper.Debug (Tag, "OnLoadChildren sending ", mediaItems.Count,
" results for ", parentId);
result.SendResult (mediaItems);
}
示例2: OnLoadChildren
public override async void OnLoadChildren (string parentId, Result result)
{
if (!musicProvider.IsInitialized) {
result.Detach ();
await musicProvider.RetrieveMediaAsync (success => {
if (success) {
LoadChildrenImpl (parentId, result);
} else {
UpdatePlaybackState (GetString (Resource.String.error_no_metadata));
result.SendResult (new JavaList<MediaBrowser.MediaItem>());
}
});
} else {
LoadChildrenImpl (parentId, result);
}
}