⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 randompicture.cs

📁 本系统是在asp版《在线文件管理器》的基础上设计制作
💻 CS
字号:
//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

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

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

		#region Public Properties

		[DefaultValue( -1 )]
		public virtual int SectionID
		{
			get
			{
				Object state = ViewState["SectionID"];
				if(state != null)
					return (int)state;
				return -1;
			}
			set { ViewState["SectionID"] = value; }
		}

		[DefaultValue("")]
		private string applicationKey;
		public string ApplicationKey
		{
			get { return applicationKey; }
			set { applicationKey = value; }
		}

		[DefaultValue( -1 )]
		public virtual int CategoryID
		{
			get
			{
				Object state = ViewState["CategoryID"];
				if(state != null)
					return (int)state;
				return -1;
			}
			set { ViewState["CategoryID"] = value; }
		}

		[DefaultValue( true )]
		public virtual bool UseLink
		{
			get
			{
				Object state = ViewState["UseLink"];
				if(state != null)
					return (bool)state;
				return true;
			}
			set { ViewState["UseLink"] = value; }
		}

		[DefaultValue( true )]
		public virtual bool LinkToPicture
		{
			get
			{
				Object state = ViewState["LinkToPicture"];
				if(state != null)
					return (bool)state;
				return true;
			}
			set { ViewState["LinkToPicture"] = value; }
		}

		#endregion

		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);
			ApplicationKey = CSContext.Current.ApplicationKey;
			CategoryID = CSContext.Current.CategoryID;

            // 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 = "RandomPicture";
		}

		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;
			}
			Picture = Pictures.GetRandomPicture(SectionID, CategoryID);
		}

	}
}

⌨️ 快捷键说明

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