highlightpicture.cs

来自「community server 源码」· CS 代码 · 共 60 行

CS
60
字号
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using CommunityServer.Components;
using CommunityServer.Galleries.Components;

namespace CommunityServer.Galleries.Controls
{
	/// <summary>
	/// Summary description for SidePortal.
	/// </summary>
	public class HighlightPicture : RandomPicture //: GalleryImage
	{

		#region Public Properties

		#endregion

		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

            // Use a different prefix for the img id attribute than the default "SmallThumb" so there won't
            //  be duplicate id's if a PictureListing control containing the random image is on the same page.
            imageIDprefix = "HighlightPicture";
		}

		protected override void LoadPicture()
		{
			if((SectionID == -1) && (ApplicationKey != ""))
				SectionID = Galleries.GetGalleryID( ApplicationKey );
			else if(SectionID == -1)
			{
				Gallery gallery = Galleries.GetRandomGallery();
				if(gallery == null)
					return;
				SectionID = gallery.SectionID;
			}

			GalleryPostCategory category = GalleryPostCategory.Parse(PostCategories.GetCategory(CategoryID, SectionID)); 

			if(category.HasFeaturedPhoto)
				GalleryPost = (GalleryPost)category.FeaturedPost;
			else 
				GalleryPost = GalleryPosts.GetFirstPicture(SectionID, CategoryID);


			if(this.UseLink && this.LinkToPicture && ApplicationKey != "" && GalleryPost != null)
				base.NavigateUrl = GalleryUrls.Instance().ViewPicture(ApplicationKey,CategoryID, GalleryPost); 
			if(this.UseLink && this.LinkToCategory && ApplicationKey != "")
				base.NavigateUrl = GalleryUrls.Instance().ViewCategory(ApplicationKey, CategoryID) ; 
		}

	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?