コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DisplayObject"/> class.
        /// </summary>
        /// <param name="parent">The parent.</param>
        /// <param name="displayType">The display type.</param>
        /// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of
        /// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param>
        private DisplayObject(IGalleryObject parent, DisplayObjectType displayType, MimeTypeCategory mimeType)
        {
            if (displayType != DisplayObjectType.External)
            {
                throw new BusinessException(String.Format(CultureInfo.CurrentCulture, "This overload of the DisplayObject constructor can only be called when the displayType parameter is DisplayObjectType.External. Instead, it was {0}.", displayType.ToString()));
            }

            this._width                = int.MinValue;
            this._height               = int.MinValue;
            this._filename             = String.Empty;
            this._mimeType             = GalleryServerPro.Business.MimeType.CreateInstance(mimeType);
            this._externalType         = this._mimeType.TypeCategory;
            this._parent               = parent;
            this._displayType          = displayType;
            this._displayObjectCreator = new NullObjects.NullDisplayObjectCreator();

            if (this._parent is IAlbum)
            {
                this._mediaObjectId = int.MinValue;
            }
            else
            {
                this._mediaObjectId = parent.Id;
            }
        }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
        /// <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 = Business.MimeType.LoadMimeType(parent.GalleryId, 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;
            }
        }
コード例 #4
0
ファイル: DisplayObject.cs プロジェクト: haimon74/KanNaim
		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;
			}
		}
コード例 #5
0
        /// <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;
            }
        }
コード例 #6
0
 /// <summary>
 /// Create a new display object instance with the specified properties. No data is retrieved from the
 /// data store. A lazy load is used to inflate the object when necessary
 /// </summary>
 /// <param name="parent">The media object to which this display object applies.</param>
 /// <param name="fileName">The name of the file representing this object. Example: sonorandesert.jpg</param>
 /// <param name="width">The width of this object, in pixels.</param>
 /// <param name="height">The height of this object, in pixels.</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>
 /// <returns>Create a new display object instance with the specified properties.</returns>
 public static IDisplayObject CreateInstance(IGalleryObject parent, string fileName, int width, int height, DisplayObjectType displayType, IDisplayObjectCreator displayObjectCreator)
 {
     return(new DisplayObject(width, height, fileName, parent, displayType, displayObjectCreator));
 }
コード例 #7
0
ファイル: DisplayObject.cs プロジェクト: haimon74/KanNaim
		/// <summary>
		/// Initializes a new instance of the <see cref="DisplayObject"/> class.
		/// </summary>
		/// <param name="parent">The parent.</param>
		/// <param name="displayType">The display type.</param>
		/// <param name="mimeType">Specifies the category to which this mime type belongs. This usually corresponds to the first portion of 
		/// the full mime type description. (e.g. "image" if the full mime type is "image/jpeg").</param>
		private DisplayObject(IGalleryObject parent, DisplayObjectType displayType, MimeTypeCategory mimeType)
		{
#if DEBUG
			tt.Tools.StartingMethod(parent, displayType, mimeType);
#endif
			if (displayType != DisplayObjectType.External)
				throw new BusinessException(String.Format("This overload of the DisplayObject constructor can only be called when the displayType parameter is DisplayObjectType.External. Instead, it was {0}.", displayType.ToString()));

			this._width = int.MinValue;
			this._height = int.MinValue;
			this._filename = String.Empty;
			this._mimeType = GalleryServerPro.Business.MimeType.CreateInstance(mimeType);
			this._externalType = this._mimeType.TypeCategory;
			this._parent = parent;
			this._displayType = displayType;
			this._displayObjectCreator = new NullObjects.NullDisplayObjectCreator();

			if (this._parent is IAlbum)
			{
				this._mediaObjectId = int.MinValue;
			}
			else
			{
				this._mediaObjectId = parent.Id;
			}

		}
コード例 #8
0
ファイル: DisplayObject.cs プロジェクト: haimon74/KanNaim
		/// <summary>
		/// Create a new display object instance with the specified properties. No data is retrieved from the
		/// data store. A lazy load is used to inflate the object when necessary
		/// </summary>
		/// <param name="parent">The media object to which this display object applies.</param>
		/// <param name="fileName">The name of the file representing this object. Example: sonorandesert.jpg</param>
		/// <param name="width">The width of this object, in pixels.</param>
		/// <param name="height">The height of this object, in pixels.</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>
		/// <returns>Create a new display object instance with the specified properties.</returns>
		public static IDisplayObject CreateInstance(IGalleryObject parent, string fileName, int width, int height, DisplayObjectType displayType, IDisplayObjectCreator displayObjectCreator)
		{
			return new DisplayObject(width, height, fileName, parent, displayType, displayObjectCreator);
		}