• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# IGalleryObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IGalleryObject的典型用法代码示例。如果您正苦于以下问题:C# IGalleryObject类的具体用法?C# IGalleryObject怎么用?C# IGalleryObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IGalleryObject类属于命名空间,在下文中一共展示了IGalleryObject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetImageHeight

		protected static int GetImageHeight(IGalleryObject galleryObject)
		{
			if (galleryObject.Optimized.Height > int.MinValue)
				return galleryObject.Optimized.Height;
			else
				return galleryObject.Thumbnail.Height;
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:7,代码来源:rotateimage.aspx.cs


示例2: Add

        /// <summary>
        /// Adds the specified gallery object.
        /// </summary>
        /// <param name="item">The gallery object.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="item" /> is null.</exception>
        public void Add(IGalleryObject item)
        {
            if (item == null)
                throw new ArgumentNullException("item", "Cannot add null to an existing GalleryObjectCollection. Items.Count = " + Items.Count);

            Items.TryAdd(GetKey(item), item);
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:12,代码来源:GalleryObjectCollection.cs


示例3: GetImageUrl

		protected string GetImageUrl(IGalleryObject galleryObject)
		{
			if ((galleryObject.Optimized.Width > int.MinValue) || (galleryObject.Optimized.Height > int.MinValue))
				return GetOptimizedUrl(galleryObject);
			else
				return GetThumbnailUrl(galleryObject);
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:7,代码来源:rotateimage.aspx.cs


示例4: Dispose

		private bool _hasBeenDisposed; // Used by Dispose() methods
		
		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the <see cref="DisplayObject"/> class.
		/// </summary>
		/// <param name="width">The width of this object, in pixels.</param>
		/// <param name="height">The height of this object, in pixels.</param>
		/// <param name="filename">The name of the file representing this object. Example: sonorandesert.jpg</param>
		/// <param name="parent">The media object to which this display object applies.</param>
		/// <param name="displayType">The type of the display object.</param>
		/// <param name="displayObjectCreator">The object responsible for generating the file this display object points to.</param>
		private DisplayObject(int width, int height, string filename, IGalleryObject parent, DisplayObjectType displayType, IDisplayObjectCreator displayObjectCreator)
		{
#if DEBUG
			tt.Tools.StartingMethod(width, height, filename, parent, displayType, displayObjectCreator);
#endif

			this._width = width;
			this._height = height;
			this._filename = filename;

			if (!String.IsNullOrEmpty(filename))
			{
				this._mimeType = GalleryServerPro.Business.MimeType.LoadInstanceByFilePath(this._filename);
			}

			if (this._mimeType == null)
			{
				this._mimeType = new NullObjects.NullMimeType();
			}

			this._parent = parent;
			this._displayType = displayType;
			this._displayObjectCreator = displayObjectCreator;

			if (this._parent is IAlbum)
			{
				this._mediaObjectId = int.MinValue;
			}
			else
			{
				this._mediaObjectId = parent.Id;
			}
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:48,代码来源:DisplayObject.cs


示例5: Save

		/// <summary>
		/// Persist the specified media object to the data store. Return the ID of the media object.
		/// </summary>
		/// <param name="mediaObject">An instance of <see cref="IGalleryObject" /> to persist to the data store.</param>
		/// <returns>Return the ID of the media object. If this is a new media object and a new ID has been
		/// assigned, then this value has also been assigned to the ID property of the object.</returns>
		public static int Save(IGalleryObject mediaObject)
		{
			int mediaObjectId = mediaObject.Id;

			if (mediaObject.IsNew)
			{
				// Insert new record into MediaObject table.
				SqlCommand cmd = GetCommandMediaObjectInsert(mediaObject);
				cmd.Connection.Open();
				cmd.ExecuteNonQuery();
				cmd.Connection.Close();

				mediaObjectId = Convert.ToInt32(cmd.Parameters["@Identity"].Value, System.Globalization.NumberFormatInfo.InvariantInfo);

				if (mediaObject.Id != mediaObjectId)
				{
					mediaObject.Id = mediaObjectId;
				}

				// Insert metadata items, if any, into MediaObjectMetadata table.
				InsertMetadataItems(mediaObject);
			}
			else
			{
				SqlCommand cmd = GetCommandMediaObjectUpdate(mediaObject);
				cmd.Connection.Open();
				cmd.ExecuteNonQuery();
				cmd.Connection.Close();

				// Update metadata items, if necessary, in MediaObjectMetadata table.
				UpdateMetadataItems(mediaObject);
			}

			return mediaObjectId;
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:41,代码来源:MediaObject.cs


示例6: GetImageWidth

		protected static int GetImageWidth(IGalleryObject galleryObject)
		{
			if (galleryObject.Optimized.Width > int.MinValue)
				return galleryObject.Optimized.Width;
			else
				return galleryObject.Thumbnail.Width;
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:7,代码来源:rotateimage.aspx.cs


示例7: DisplayObject

        /// <summary>
        /// Initializes a new instance of the <see cref="DisplayObject"/> class.
        /// </summary>
        /// <param name="width">The width of this object, in pixels.</param>
        /// <param name="height">The height of this object, in pixels.</param>
        /// <param name="filename">The name of the file representing this object. Example: sonorandesert.jpg</param>
        /// <param name="parent">The media object to which this display object applies.</param>
        /// <param name="displayType">The type of the display object.</param>
        /// <param name="displayObjectCreator">The object responsible for generating the file this display object points to.</param>
        private DisplayObject(int width, int height, string filename, IGalleryObject parent, DisplayObjectType displayType, IDisplayObjectCreator displayObjectCreator)
        {
            this._width = width;
            this._height = height;
            this._filename = filename;

            if (!String.IsNullOrEmpty(filename))
            {
                this._mimeType = Factory.LoadMimeType(parent.GalleryId, this._filename);
            }

            if (this._mimeType == null)
            {
                this._mimeType = new NullObjects.NullMimeType();
            }

            this._parent = parent;
            this._displayType = displayType;
            this._displayObjectCreator = displayObjectCreator;
            this._displayObjectCreator.Parent = this;

            if (this._parent is IAlbum)
            {
                this._mediaObjectId = int.MinValue;
            }
            else
            {
                this._mediaObjectId = parent.Id;
            }
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:39,代码来源:DisplayObject.cs


示例8: GetId

 /// <summary>
 /// Gets a value that uniquely identifies the specified <paramref name="galleryObject" /> (ex: "a25", "m223").
 /// </summary>
 /// <param name="galleryObject">The gallery object.</param>
 /// <returns>Returns an ID.</returns>
 protected static string GetId(IGalleryObject galleryObject)
 {
     // Prepend an 'a' (for album) or 'm' (for media object) to the ID to indicate whether it is
     // an album ID or media object ID.
     if (galleryObject is Album)
         return "a" + galleryObject.Id.ToString(CultureInfo.InvariantCulture);
     else
         return "m" + galleryObject.Id.ToString(CultureInfo.InvariantCulture);
 }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:14,代码来源:assignthumbnail.ascx.cs


示例9: CopyGalleryObject

        /// <summary>
        /// Copy the specified object and place it in the specified destination album. This method creates a completely separate copy
        /// of the original, including copying the physical files associated with this object. The copy is persisted to the data
        /// store and then returned to the caller. When copying albums, all the album's children, grandchildren, etc are also copied.
        /// The audit fields of the copied objects are automatically updated before saving.
        /// </summary>
        /// <param name="galleryObjectToCopy">The gallery object to copy.</param>
        /// <param name="destinationAlbum">The album to which the current object should be copied.</param>
        /// <returns>
        /// Returns a new gallery object that is an exact copy of the original, except that it resides in the specified
        /// destination album, and of course has a new ID. Child objects are recursively copied.
        /// </returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObjectToCopy" /> is null.</exception>
        public static IGalleryObject CopyGalleryObject(IGalleryObject galleryObjectToCopy, IAlbum destinationAlbum)
        {
            if (galleryObjectToCopy == null)
                throw new ArgumentNullException("galleryObjectToCopy");

            string currentUser = Utils.UserName;

            return galleryObjectToCopy.CopyTo(destinationAlbum, currentUser);
        }
开发者ID:raquelsa,项目名称:GalleryServerProWeb,代码行数:22,代码来源:GalleryObjectController.cs


示例10: MoveGalleryObject

		/// <summary>
		/// Move the specified object to the specified destination album. This method moves the physical files associated with this
		/// object to the destination album's physical directory. The object's Save() method is invoked to persist the changes to the
		/// data store. When moving albums, all the album's children, grandchildren, etc are also moved. 
		/// The audit fields are automatically updated before saving.
		/// </summary>
		/// <param name="galleryObjectToMove">The gallery object to move.</param>
		/// <param name="destinationAlbum">The album to which the current object should be moved.</param>
		public static void MoveGalleryObject(IGalleryObject galleryObjectToMove, IAlbum destinationAlbum)
		{
			string currentUser = Util.UserName;
			DateTime currentTimestamp = DateTime.Now;

			galleryObjectToMove.LastModifiedByUserName = currentUser;
			galleryObjectToMove.DateLastModified = currentTimestamp;

			galleryObjectToMove.MoveTo(destinationAlbum);
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:18,代码来源:GalleryObjectController.cs


示例11: GetSavings

        /// <summary>
        /// Calculate the potential hard drive savings, in KB, if all original files were deleted from <paramref name="galleryObject"/>.
        /// If <paramref name="galleryObject"/> is an Album, then the value includes the sum of the size of all original files
        /// within the album.
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>Returns the potential hard drive savings, in KB, if all original files were deleted from <paramref name="galleryObject"/>.</returns>
        protected static string GetSavings(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if (galleryObject.GetType() == typeof(Album))
                return String.Format(CultureInfo.CurrentCulture, "({0} KB)", GetFileSizeKbAllOriginalFilesInAlbum((IAlbum)galleryObject));
            else
                return String.Format(CultureInfo.CurrentCulture, "({0} KB)", galleryObject.Original.FileSizeKB);
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:17,代码来源:deletehires.ascx.cs


示例12: GetImageWidth

        /// <summary>
        /// Gets the width of the specified <paramref name="galleryObject" />.
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>The width.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObject" /> is null.</exception>
        protected static int GetImageWidth(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if (galleryObject.Optimized.Width > int.MinValue)
                return galleryObject.Optimized.Width;
            else
                return galleryObject.Thumbnail.Width;
        }
开发者ID:raquelsa,项目名称:GalleryServerProWeb,代码行数:16,代码来源:rotateimage.ascx.cs


示例13: GetThumbnailCssClass

 /// <summary>
 /// Gets the CSS class to apply to the thumbnail object.
 /// </summary>
 /// <param name="galleryObject">The gallery object.</param>
 /// <returns>Returns a CSS class.</returns>
 protected static string GetThumbnailCssClass(IGalleryObject galleryObject)
 {
     // If it's an album then specify the appropriate CSS class so that the "Album"
     // header appears over the thumbnail. This is to indicate to the user that the
     // thumbnail represents an album.
     if (galleryObject is Album)
         return "thmb album";
     else
         return "thmb";
 }
开发者ID:raquelsa,项目名称:GalleryServerProWeb,代码行数:15,代码来源:deleteobjects.ascx.cs


示例14: GetMediaObjectUrl

        protected string GetMediaObjectUrl(IGalleryObject mediaObject)
        {
            switch (mediaObject.GalleryObjectType)
            {
                case GalleryObjectType.Image: return GetOptimizedUrl(mediaObject);
                case GalleryObjectType.Video: return GetThumbnailUrl(mediaObject);
            }

            return null;
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:10,代码来源:rotateimage.ascx.cs


示例15: GetImageUrl

        /// <summary>
        /// Gets the URL to the specified <paramref name="galleryObject" />.
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>Returns a string.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObject" /> is null.</exception>
        protected string GetImageUrl(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if ((galleryObject.Optimized.Width > int.MinValue) || (galleryObject.Optimized.Height > int.MinValue))
                return GetOptimizedUrl(galleryObject);
            else
                return GetThumbnailUrl(galleryObject);
        }
开发者ID:raquelsa,项目名称:GalleryServerProWeb,代码行数:16,代码来源:rotateimage.ascx.cs


示例16: GetId

        /// <summary>
        /// Gets a value that uniquely identifies the specified <paramref name="galleryObject" /> (ex: "a25", "m223").
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>Returns an ID.</returns>
        protected static string GetId(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            // Prepend an 'a' (for album) or 'm' (for media object) to the ID to indicate whether it is
            // an album ID or media object ID.
            if (galleryObject is Album)
                return "a" + galleryObject.Id.ToString(CultureInfo.InvariantCulture);
            else
                return "m" + galleryObject.Id.ToString(CultureInfo.InvariantCulture);
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:17,代码来源:downloadobjects.ascx.cs


示例17: GetWidthAndHeightStyle

        protected static string GetWidthAndHeightStyle(IGalleryObject mediaObject)
        {
            var width = mediaObject.Optimized.Width;
            var height = mediaObject.Optimized.Height;

            if (mediaObject.GalleryObjectType == GalleryObjectType.Video)
            {
                width = mediaObject.Thumbnail.Width;
                height = mediaObject.Thumbnail.Height;
            }

            return String.Format(CultureInfo.InvariantCulture, "width:{0}px;height:{1}px;", width, height);
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:13,代码来源:rotateimage.ascx.cs


示例18: Delete

 /// <summary>
 /// Permanently delete the specified media object from the data store. This action cannot
 /// be undone. This action also deletes the related metadata items.
 /// </summary>
 /// <param name="mediaObject">The <see cref="IGalleryObject" /> to delete from the data store.</param>
 public static void Delete(IGalleryObject mediaObject)
 {
     // Related metadata items in the MediaObjectMetadataItem table are deleted
     // via a cascade delete rule configured between this table and the MediaObject table.
     using (SqlConnection cn = SqlDataProvider.GetDbConnection())
     {
         using (SqlCommand cmd = GetCommandMediaObjectDelete(mediaObject.Id, cn))
         {
             cn.Open();
             cmd.ExecuteNonQuery();
         }
     }
 }
开发者ID:raquelsa,项目名称:GalleryServerProWeb,代码行数:18,代码来源:MediaObject.cs


示例19: GalleryObjectMetadataItem

 /// <summary>
 /// Initializes a new instance of the <see cref="GalleryObjectMetadataItem" /> class.
 /// </summary>
 /// <param name="mediaObjectMetadataId">The value that uniquely indentifies this metadata item.</param>
 /// <param name="galleryObject">The gallery object this metadata item applies to.</param>
 /// <param name="rawValue">The raw value of the metadata item. Typically this is the value extracted from 
 /// the metadata of the media file.</param>
 /// <param name="value">The value of the metadata item (e.g. "F5.7", "1/500 sec.").</param>
 /// <param name="hasChanges">if set to <c>true</c> this object has changes that have not been persisted to the database.</param>
 /// <param name="metaDef">The meta definition.</param>
 public GalleryObjectMetadataItem(int mediaObjectMetadataId, IGalleryObject galleryObject, string rawValue, string value, bool hasChanges, IMetadataDefinition metaDef)
 {
     _mediaObjectMetadataId = mediaObjectMetadataId;
     GalleryObject = galleryObject;
     _metadataItemName = metaDef.MetadataItem;
     _description = metaDef.DisplayName;
     _rawValue = rawValue;
     _value = value;
     _hasChanges = hasChanges;
     MetaDefinition = metaDef;
     _isVisible = false;
     IsDeleted = false;
 }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:23,代码来源:GalleryObjectMetadataItem.cs


示例20: MoveGalleryObject

        /// <summary>
        /// Move the specified object to the specified destination album. This method moves the physical files associated with this
        /// object to the destination album's physical directory. The object's Save() method is invoked to persist the changes to the
        /// data store. When moving albums, all the album's children, grandchildren, etc are also moved. 
        /// The audit fields are automatically updated before saving.
        /// </summary>
        /// <param name="galleryObjectToMove">The gallery object to move.</param>
        /// <param name="destinationAlbum">The album to which the current object should be moved.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObjectToMove" /> is null.</exception>
        public static void MoveGalleryObject(IGalleryObject galleryObjectToMove, IAlbum destinationAlbum)
        {
            if (galleryObjectToMove == null)
                throw new ArgumentNullException("galleryObjectToMove");

            string currentUser = Utils.UserName;
            DateTime currentTimestamp = DateTime.Now;

            galleryObjectToMove.LastModifiedByUserName = currentUser;
            galleryObjectToMove.DateLastModified = currentTimestamp;

            galleryObjectToMove.MoveTo(destinationAlbum);
        }
开发者ID:xusun,项目名称:GalleryServerPro,代码行数:22,代码来源:GalleryObjectController.cs



注:本文中的IGalleryObject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IGame类代码示例发布时间:2022-05-24
下一篇:
C# IGH_DataAccess类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap