本文整理汇总了C#中MediaBrowser.Model.Dto.BaseItemDto类的典型用法代码示例。如果您正苦于以下问题:C# BaseItemDto类的具体用法?C# BaseItemDto怎么用?C# BaseItemDto使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseItemDto类属于MediaBrowser.Model.Dto命名空间,在下文中一共展示了BaseItemDto类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPlayablePath
/// <summary>
/// Gets the playable path.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="isoMount">The iso mount.</param>
/// <param name="apiClient">The API client.</param>
/// <param name="startTimeTicks">The start time ticks.</param>
/// <returns>System.String.</returns>
public static string GetPlayablePath(BaseItemDto item, IIsoMount isoMount, IApiClient apiClient, long? startTimeTicks)
{
// Check the mounted path first
if (isoMount != null)
{
if (item.IsoType.HasValue && item.IsoType.Value == IsoType.BluRay)
{
return GetBlurayPath(isoMount.MountedPath);
}
return isoMount.MountedPath;
}
// Stream remote items through the api
if (item.LocationType == LocationType.Remote)
{
return GetStreamedPath(item, apiClient, startTimeTicks);
}
// Stream if we can't access the file system
if (!File.Exists(item.Path) && !Directory.Exists(item.Path))
{
return GetStreamedPath(item, apiClient, startTimeTicks);
}
if (item.VideoType.HasValue && item.VideoType.Value == VideoType.BluRay)
{
return GetBlurayPath(item.Path);
}
return item.Path;
}
示例2: OnNavigatedTo
protected override void OnNavigatedTo(NavigationEventArgs e)
{
base.OnNavigatedTo(e);
if (e.NavigationMode == NavigationMode.New)
{
var selectedItem = new BaseItemDto();
if(App.SelectedItem == null)
{
string name, id;
if (NavigationContext.QueryString.TryGetValue("name", out name) &&
NavigationContext.QueryString.TryGetValue("id", out id))
{
selectedItem = new BaseItemDto
{
Name = name,
Id = id,
Type = "FolderCollection"
};
}
}
if (App.SelectedItem is BaseItemDto)
{
selectedItem = (BaseItemDto) App.SelectedItem;
}
DataContext = new FolderViewModel(ViewModelLocator.NavigationService, ViewModelLocator.ConnectionManager)
{
SelectedFolder = selectedItem
};
}
}
示例3: UpdateCommunityRating
/// <summary>
/// Updates the community rating.
/// </summary>
/// <param name="item">The item.</param>
private void UpdateCommunityRating(BaseItemDto item)
{
if (!item.CommunityRating.HasValue)
{
return;
}
var images = new[] { ImgCommunityRating1, ImgCommunityRating2, ImgCommunityRating3, ImgCommunityRating4, ImgCommunityRating5 };
var rating = item.CommunityRating.Value;
for (var i = 0; i < 5; i++)
{
var img = images[i];
var starValue = (i + 1) * 2;
if (rating < starValue - 2)
{
img.SetResourceReference(StyleProperty, "CommunityRatingImageEmpty");
}
else if (rating < starValue)
{
img.SetResourceReference(StyleProperty, "CommunityRatingImageHalf");
}
else
{
img.SetResourceReference(StyleProperty, "CommunityRatingImageFull");
}
}
}
示例4: TrailerViewModel
/// <summary>
/// Initializes a new instance of the TrailerViewModel class.
/// </summary>
public TrailerViewModel(INavigationService navigation, IConnectionManager connectionManager)
: base(navigation, connectionManager)
{
if (IsInDesignMode)
{
SelectedTrailer = new BaseItemDto
{
Name = "Jurassic Park 3D",
Overview =
"Universal Pictures will release Steven Spielberg\u2019s groundbreaking masterpiece JURASSIC PARK in 3D on April 5, 2013. With his remastering of the epic into a state-of-the-art 3D format, Spielberg introduces the three-time Academy Award\u00AE-winning blockbuster to a new generation of moviegoers and allows longtime fans to experience the world he envisioned in a way that was unimaginable during the film\u2019s original release. Starring Sam Neill, Laura Dern, Jeff Goldblum, Samuel L. Jackson and Richard Attenborough, the film based on the novel by Michael Crichton is produced by Kathleen Kennedy and Gerald R. Molen.",
PremiereDate = DateTime.Parse("2013-04-05T00:00:00.0000000"),
Id = "4aed3d79a0c4c2a0ac9c91fb7a641f1a",
ProductionYear = 2013,
People = new[]
{
new BaseItemPerson {Name = "Steven Spielberg", Type = "Director"},
new BaseItemPerson {Name = "Sam Neill", Type = "Actor"},
new BaseItemPerson {Name = "Richard Attenborough", Type = "Actor"},
new BaseItemPerson {Name = "Laura Dern", Type = "Actor"}
}
};
CastAndCrew = Utils.GroupCastAndCrew(SelectedTrailer.People);
}
else
{
WireCommands();
}
}
示例5: FolderViewModel
/// <summary>
/// Initializes a new instance of the FolderViewModel class.
/// </summary>
public FolderViewModel(INavigationService navigationService, IConnectionManager connectionManager)
: base(navigationService, connectionManager)
{
RecentItems = new ObservableCollection<BaseItemDto>();
RandomItems = new ObservableCollection<BaseItemDto>();
if (IsInDesignMode)
{
SelectedFolder = new BaseItemDto
{
Name = "Movies"
};
RecentItems.Add(new BaseItemDto
{
Id = "6536a66e10417d69105bae71d41a6e6f",
Name = "Jurassic Park",
SortName = "Jurassic Park",
Overview = "Lots of dinosaurs eating people!",
People = new[]
{
new BaseItemPerson {Name = "Steven Spielberg", Type = "Director"},
new BaseItemPerson {Name = "Sam Neill", Type = "Actor"},
new BaseItemPerson {Name = "Richard Attenborough", Type = "Actor"},
new BaseItemPerson {Name = "Laura Dern", Type = "Actor"}
}
});
}
else
{
WireCommands();
GroupBy = GroupBy.Name;
}
}
示例6: MainViewModel
/// <summary>
/// Initializes a new instance of the MainViewModel class.
/// </summary>
public MainViewModel(IConnectionManager connectionManager, INavigationService navigationService, IPlaybackManager playbackManager)
: base(navigationService, connectionManager)
{
_playbackManager = playbackManager;
Folders = new ObservableCollection<BaseItemDto>();
RecentItems = new ObservableCollection<BaseItemDto>();
FavouriteItems = new ObservableCollection<BaseItemDto>();
InProgressItems = new ObservableCollection<BaseItemDto>();
UserViews = new ObservableCollection<BaseItemDto>();
if (IsInDesignMode)
{
Folders.Add(new BaseItemDto { Id = "78dbff5aa1c2101b98ebaf42b72a988d", Name = "Movies", UserData = new UserItemDataDto { UnplayedItemCount = 6 } });
RecentItems.Add(new BaseItemDto { Id = "2fc6f321b5f8bbe842fcd0eed089561d", Name = "A Night To Remember" });
}
else
{
WireCommands();
DummyFolder = new BaseItemDto
{
Type = "folder",
Name = AppResources.LabelRecent.ToLower()
};
}
}
示例7: GetSections
public override async Task<IEnumerable<IItemDetailSection>> GetSections(BaseItemDto item)
{
return new[] {
await GetMovies(item),
await GetSeries(item)
};
}
示例8: TvViewModel
/// <summary>
/// Initializes a new instance of the TvViewModel class.
/// </summary>
public TvViewModel(INavigationService navigationService, IConnectionManager connectionManager, IMessageBoxService messageBox)
: base(navigationService, connectionManager)
{
_messageBox = messageBox;
RecentItems = new ObservableCollection<BaseItemDto>();
Episodes = new List<BaseItemDto>();
CanUpdateFavourites = true;
if (IsInDesignMode)
{
SelectedTvSeries = new BaseItemDto
{
Name = "Scrubs"
};
SelectedSeason = new BaseItemDto
{
Name = "Season 1"
};
Episodes = new[]
{
new BaseItemDto
{
Id = "e252ea3059d140a0274282bc8cd194cc",
Name = "1x01 - Pilot",
Overview =
"A Kindergarten teacher starts speaking gibberish and passed out in front of her class. What looks like a possible brain tumor does not respond to treatment and provides many more questions than answers for House and his team as they engage in a risky trial-and-error approach to her case. When the young teacher refuses any additional variations of treatment and her life starts slipping away, House must act against his code of conduct and make a personal visit to his patient to convince her to trust him one last time."
}
}.ToList();
SelectedEpisode = Episodes[0];
}
else
{
WireCommands();
}
}
示例9: GetInstantMixPlaylist
internal static async Task<List<PlaylistItem>> GetInstantMixPlaylist(this IApiClient apiClient, BaseItemDto item, IPlaybackManager playbackManager)
{
ItemsResult result;
var query = new SimilarItemsQuery { UserId = AuthenticationService.Current.LoggedInUserId, Id = item.Id, Fields = new []{ ItemFields.MediaSources}};
switch (item.Type)
{
case "Audio":
result = await apiClient.GetInstantMixFromSongAsync(query);
break;
case "MusicArtist":
result = await apiClient.GetInstantMixFromArtistAsync(query);
break;
case "MusicAlbum":
result = await apiClient.GetInstantMixFromAlbumAsync(query);
break;
case "Genre":
result = await apiClient.GetInstantMixFromMusicGenreAsync(query);
break;
default:
return new List<PlaylistItem>();
}
if (result == null || result.Items.IsNullOrEmpty())
{
return new List<PlaylistItem>();
}
return await result.Items.ToList().ToPlayListItems(apiClient, playbackManager);
}
示例10: GetHomePage
public Page GetHomePage(BaseItemDto rootFolder)
{
return new HomePage(rootFolder, _presentationManager)
{
DataContext = new HomePageViewModel(_presentationManager, _sessionManager, _logger, _imageManager, _navigationManager, _playbackManager, _connectionManager)
};
}
示例11: SetTitle
private void SetTitle(BaseItemDto item)
{
if (item.Taglines.Count > 0)
{
TxtName.Text = item.Taglines[0];
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsType("episode"))
{
TxtName.Text = GetEpisodeTitle(item);
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsType("audio"))
{
TxtName.Text = GetSongTitle(item);
TxtName.Visibility = Visibility.Visible;
}
else if (item.IsPerson || item.IsArtist || item.IsGenre || item.IsGameGenre || item.IsMusicGenre || item.IsStudio)
{
TxtName.Text = item.Name;
TxtName.Visibility = Visibility.Visible;
}
else
{
TxtName.Visibility = Visibility.Collapsed;
}
}
示例12: VideoMessage
public VideoMessage(IList<BaseItemDto> playlist, BaseItemDto firstItem, bool isResume)
{
VideoPlaylists = playlist;
VideoItem = firstItem;
IsResume = isResume;
PlayerSourceType = PlayerSourceType.Playlist;
}
示例13: MovieViewModel
/// <summary>
/// Initializes a new instance of the MovieViewModel class.
/// </summary>
public MovieViewModel(INavigationService navigationService, IConnectionManager connectionManager)
: base(navigationService, connectionManager)
{
CanUpdateFavourites = true;
if (IsInDesignMode)
{
SelectedMovie = new BaseItemDto
{
Id = "6536a66e10417d69105bae71d41a6e6f",
Name = "Jurassic Park",
SortName = "Jurassic Park",
Overview = "Lots of dinosaurs eating people!",
People = new[]
{
new BaseItemPerson {Name = "Steven Spielberg", Type = "Director"},
new BaseItemPerson {Name = "Sam Neill", Type = "Actor"},
new BaseItemPerson {Name = "Richard Attenborough", Type = "Actor"},
new BaseItemPerson {Name = "Laura Dern", Type = "Actor"}
}
};
}
else
{
WireCommands();
}
}
示例14: GetPlayablePath
/// <summary>
/// Gets the playable path.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="isoMount">The iso mount.</param>
/// <param name="apiClient">The API client.</param>
/// <param name="startTimeTicks">The start time ticks.</param>
/// <returns>System.String.</returns>
public static string GetPlayablePath(BaseItemDto item, IIsoMount isoMount, IApiClient apiClient, long? startTimeTicks, int? maxBitrate)
{
// Check the mounted path first
if (isoMount != null)
{
if (item.IsoType.HasValue && item.IsoType.Value == IsoType.BluRay)
{
return GetBlurayPath(isoMount.MountedPath);
}
return isoMount.MountedPath;
}
if (item.LocationType == LocationType.FileSystem)
{
if (File.Exists(item.Path) || Directory.Exists(item.Path))
{
if (item.VideoType.HasValue && item.VideoType.Value == VideoType.BluRay)
{
return GetBlurayPath(item.Path);
}
return item.Path;
}
}
return GetStreamedPath(item, apiClient, startTimeTicks, maxBitrate);
}
示例15: OnItemChanged
private void OnItemChanged(ItemViewModel viewModel, BaseItemDto item)
{
UpdateLogo(viewModel, item);
TxtGenres.Visibility = item.Genres.Count > 0 && !item.IsType("episode") && !item.IsType("season") ? Visibility.Visible : Visibility.Collapsed;
TxtGenres.Text = string.Join(" / ", item.Genres.Take(3).ToArray());
}