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

📄 exiflisting.cs

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

using System.Collections;
using System.Web.UI.WebControls;
using CommunityServer.Components;
using CommunityServer.Galleries.Components;

namespace CommunityServer.Galleries.Controls
{

	public class ExifListing : GalleryThemedControl
	{

		#region Child Controls

		private Repeater ExifProperties;

		#endregion

		#region Public Properties

		private Picture dataSource = null;
		public Picture DataSource
		{
			get { return dataSource; }
			set { dataSource = value; }
		}

		#endregion

		#region Skin

		protected override void AttachChildControls()
		{
			ExifProperties = (Repeater)FindControl( "ExifProperties" );

			InitializeChildControls();
		}

		private void InitializeChildControls()
		{
			if(ExifProperties != null)
				ExifProperties.ItemDataBound += new RepeaterItemEventHandler(ExifProperties_ItemDataBound);
		}

		#endregion

		public override void DataBind()
		{
			base.DataBind ();
			if(DataSource == null)
				DataSource = Pictures.GetPicture(CSContext.Current.PostID);
			BindExifProperties();
		}

		private void BindExifProperties()
		{
			if(!DataSource.EnableExif)
			{
				this.Visible = false;
				return;
			}

			// Set the data source for the EXIF properties
			if(ExifProperties != null)
			{
				Hashtable metadata = Pictures.GetPictureMetadata(DataSource.PostID);
				ExifProperty[] properties = CurrentGallery.DisplayExifProperties;
				ArrayList displayProperties = new ArrayList();

				foreach(ExifProperty property in properties)
					if(metadata.Contains(property))
						displayProperties.Add( MetadataDescriptor.GetDescriptor(property, metadata[property]) );

				if(displayProperties.Count == 0)
					this.Visible = false;
				else
				{
					ExifProperties.DataSource = displayProperties;
					ExifProperties.DataBind();
				}
			}
		}

		private void ExifProperties_ItemDataBound(object sender, RepeaterItemEventArgs e)
		{
			MetadataDescriptor dataItem = (MetadataDescriptor)e.Item.DataItem;

			switch( e.Item.ItemType ) 
			{
				case ListItemType.Item:
				case ListItemType.AlternatingItem:

					((Literal)e.Item.FindControl( "PropertyName" )).Text = dataItem.Description;
					((Literal)e.Item.FindControl( "PropertyValue" )).Text = dataItem.ToString();

					break;
			}
		}
	}
}

⌨️ 快捷键说明

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