当前位置: 首页>>代码示例>>C#>>正文


C# IGalleryObject类代码示例

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


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


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