本文整理汇总了C#中IMediaService类的典型用法代码示例。如果您正苦于以下问题:C# IMediaService类的具体用法?C# IMediaService怎么用?C# IMediaService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMediaService类属于命名空间,在下文中一共展示了IMediaService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MediaServiceSaved
static void MediaServiceSaved(IMediaService sender, SaveEventArgs<IMedia> e)
{
foreach (var item in e.SavedEntities)
{
library.ClearLibraryCacheForMedia(item.Id);
}
}
示例2: UploadController
/// <summary>
/// 构造函数
/// </summary>
public UploadController(ILogger logger, IConfigService configService, IMediaService mediaService)
{
_logger = logger;
_configService = configService;
_mediaService = mediaService;
saveRootPath = _configService.GetByKey<string>("UploadRootDir", "UploadFiles");
}
示例3: DirectoryCleanupTask
public DirectoryCleanupTask(IContentManager contentManager,
IMediaService mediaService)
{
_contentManager = contentManager;
_mediaService = mediaService;
Logger = NullLogger.Instance;
}
示例4: GetOrCreateMediaItem
/// <summary>
/// Get or Create a media folder
/// </summary>
/// <param name="mediaName"></param>
/// <param name="mediaService"></param>
/// <param name="documentType"> </param>
/// <param name="parentNodeId"></param>
/// <returns></returns>
public static IMedia GetOrCreateMediaItem(IMediaService mediaService, string documentType, int parentNodeId, string mediaName, byte[] file = null)
{
var childItems = mediaService.GetChildren(parentNodeId);
IMedia childItem = null;
var enumerable = childItems as IMedia[] ?? childItems.ToArray();
if (enumerable.Any())
{
childItem = enumerable.FirstOrDefault(i => i.Name.ToLower().Equals(mediaName.ToLower()));
}
if (childItem == null)
{
childItem = mediaService.CreateMedia(mediaName, parentNodeId, documentType);
if (file != null)
{
childItem.SetValue("umbracoFile", mediaName, new MemoryStream(file));
}
mediaService.Save(childItem);
}
return childItem;
}
示例5: MusicPlayerViewModel
public MusicPlayerViewModel(HistoryService historyService, IMediaService mediaService, VlcService mediaPlayerService)
: base(historyService, mediaService, mediaPlayerService)
{
_trackCollection = new TrackCollectionViewModel();
_mediaService.MediaEnded += MediaService_MediaEnded;
_historyService = historyService;
}
示例6: MediaService_Deleted
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void MediaService_Deleted(IMediaService sender, DeleteEventArgs<IMedia> e)
{
if (connection.State != ConnectionState.Open)
{
connection.Open();
}
foreach (var item in e.DeletedEntities)
{
string Resource = item.Name;
SqlTransaction tran = connection.BeginTransaction();
var command = new SqlCommand("dbo.[RequestCdnResourceInvalidation]", connection, tran);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Add("@resource", SqlDbType.NVarChar, 256);
command.Parameters["@resource"].Value = Resource;
command.Parameters.Add("@ConversationHandle", SqlDbType.UniqueIdentifier);
command.Parameters["@ConversationHandle"].Direction = ParameterDirection.Output;
command.ExecuteNonQuery();
tran.Commit();
}
}
示例7: MediaService_Deleted
void MediaService_Deleted(IMediaService sender, DeleteEventArgs<IMedia> e)
{
foreach (IMedia entity in e.DeletedEntities.Where(entity => entity.ContentType.Alias == PPC_2010.Data.Constants.SermonAlias))
{
ServiceLocator.Instance.Locate<ISermonRepository>().RefreshSermon(entity.Id, true);
}
}
示例8: EventsController
public EventsController(IUserProfileService profileService, IEventService eventService, IFacebookService facebookService, IMediaService mediaService)
{
_profileService = profileService;
_eventService = eventService;
_facebookService = facebookService;
_mediaService = mediaService;
}
示例9: ToPublicModel
public static SponsorPublicModel ToPublicModel(this Sponsor sponsor, IUserService userService, IMediaService pictureService, ISponsorService sponsorService, IFormatterService formatterService, MediaSettings mediaSettings)
{
var user = userService.Get(sponsor.UserId);
if (user == null)
return null;
//get sponsor data
var sponsorData = sponsorService.GetSponsorData(sponsor.BattleId, sponsor.BattleType, sponsor.UserId);
var model = new SponsorPublicModel
{
SponsorshipStatus = sponsor.SponsorshipStatus,
SponsorshipStatusName = sponsor.SponsorshipStatus.ToString(),
CustomerId = sponsor.UserId,
SeName = user.GetPermalink().ToString(),
SponsorName = user.GetPropertyValueAs<string>(PropertyNames.DisplayName),
SponsorProfileImageUrl =
pictureService.GetPictureUrl(user.GetPropertyValueAs<int>(PropertyNames.DefaultPictureId)),
SponsorshipAmount = sponsor.SponsorshipAmount,
SponsorshipAmountFormatted = formatterService.FormatCurrency(sponsor.SponsorshipAmount, ApplicationContext.Current.ActiveCurrency),
SponsorData = sponsorData.ToModel(pictureService),
SponsorshipType = sponsor.SponsorshipType
};
return model;
}
示例10: ServiceContext
/// <summary>
/// public ctor - will generally just be used for unit testing
/// </summary>
/// <param name="contentService"></param>
/// <param name="mediaService"></param>
/// <param name="contentTypeService"></param>
/// <param name="dataTypeService"></param>
/// <param name="fileService"></param>
/// <param name="localizationService"></param>
/// <param name="packagingService"></param>
/// <param name="entityService"></param>
/// <param name="relationService"></param>
/// <param name="sectionService"></param>
/// <param name="treeService"></param>
/// <param name="tagService"></param>
public ServiceContext(
IContentService contentService,
IMediaService mediaService,
IContentTypeService contentTypeService,
IDataTypeService dataTypeService,
IFileService fileService,
ILocalizationService localizationService,
PackagingService packagingService,
IEntityService entityService,
IRelationService relationService,
ISectionService sectionService,
IApplicationTreeService treeService,
ITagService tagService)
{
_tagService = new Lazy<ITagService>(() => tagService);
_contentService = new Lazy<IContentService>(() => contentService);
_mediaService = new Lazy<IMediaService>(() => mediaService);
_contentTypeService = new Lazy<IContentTypeService>(() => contentTypeService);
_dataTypeService = new Lazy<IDataTypeService>(() => dataTypeService);
_fileService = new Lazy<IFileService>(() => fileService);
_localizationService = new Lazy<ILocalizationService>(() => localizationService);
_packagingService = new Lazy<PackagingService>(() => packagingService);
_entityService = new Lazy<IEntityService>(() => entityService);
_relationService = new Lazy<IRelationService>(() => relationService);
_sectionService = new Lazy<ISectionService>(() => sectionService);
_treeService = new Lazy<IApplicationTreeService>(() => treeService);
}
示例11: AdminController
public AdminController(IOrchardServices services, IMediaService mediaService) {
Services = services;
_mediaService = mediaService;
T = NullLocalizer.Instance;
Logger = NullLogger.Instance;
}
示例12: MediaServiceSaving
static void MediaServiceSaving(IMediaService sender, Core.Events.SaveEventArgs<IMedia> e)
{
foreach (var m in e.SavedEntities)
{
AutoFillProperties(m);
}
}
示例13: ContentTypeService
public ContentTypeService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, IContentService contentService, IMediaService mediaService)
{
_uowProvider = provider;
_repositoryFactory = repositoryFactory;
_contentService = contentService;
_mediaService = mediaService;
}
示例14: ThumbnailsService
public ThumbnailsService(ShellSettings settings, IWorkContextAccessor wca, ICacheManager cacheManager, IMediaService mediaService, ISignals signals, IStorageProvider storageProvider)
{
_wca = wca;
_cacheManager = cacheManager;
_mediaService = mediaService;
_signals = signals;
_storageProvider = storageProvider;
var appPath = "";
if (HostingEnvironment.IsHosted)
{
appPath = HostingEnvironment.ApplicationVirtualPath;
}
if (!appPath.EndsWith("/"))
appPath = appPath + '/';
if (!appPath.StartsWith("/"))
appPath = '/' + appPath;
_publicPath = appPath + "Media/" + settings.Name + "/";
var physPath = ThumbnailsCacheMediaPath.Replace('/', Path.DirectorySeparatorChar);
var parent = Path.GetDirectoryName(physPath);
var folder = Path.GetFileName(physPath);
if (_mediaService.GetMediaFolders(parent).All(f => f.Name != folder))
{
_mediaService.CreateFolder(parent, folder);
}
}
示例15: WikiPageController
public WikiPageController(IOrchardServices orchardServices,
IRepository<WikiPageAttachmentRecord> repoWikiAttachment,
ITagService tagService,
IAuthorizationService authorizationService,
INotifier notifier,
ISiteService siteService,
ISearchService searchService,
IShapeFactory shapeFactory,
IWikiPageService wikiPageService,
IMediaService mediaService
){
_orchardServices = orchardServices;
_repoWikiAttachment = repoWikiAttachment;
_tagService = tagService;
_authorizationService = authorizationService;
_notifier = notifier;
_searchService = searchService;
_siteService = siteService;
_wikiPageService = wikiPageService;
_mediaService = mediaService;
Logger = NullLogger.Instance;
Shape = shapeFactory;
}