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


C# IGalleryObject.GetType方法代码示例

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


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

示例1: Add

        /// <summary>
        /// Adds the specified gallery object as a child of this gallery object.
        /// </summary>
        /// <param name="galleryObject">The <see cref="IGalleryObject" /> to add as a child of this
        /// gallery object.</param>
        /// <exception cref="System.NotSupportedException">Thrown when an inherited type
        /// does not allow the addition of child gallery objects.</exception>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="galleryObject" /> is null.</exception>
        public override void Add(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            // Do not add object if it already exists in our collection. An object is uniquely identified by its ID and type.
            // For example, this album may contain a gallery object of type Image with ID=25 and also a child album of type Album
            // with ID = 25.
            if (galleryObject.Id > int.MinValue)
            {
                //System.Diagnostics.Debug.Assert(this._galleryObjects.Count == 0, String.Format(CultureInfo.CurrentCulture, "this._galleryObjects.Count = {0}", this._galleryObjects.Count));
                lock (this._galleryObjects)
                {
                    foreach (IGalleryObject go in this._galleryObjects)
                    {
                        if ((go.Id == galleryObject.Id) && (go.GetType() == galleryObject.GetType()))
                            return;
                    }
                }
            }

            // If the current album is virtual, meaning that it is a temporary container for one or more objects and not the actual
            // parent album, then we want to add the object as a child of this album but we don't want to set the Parent property
            // of the child object, since that will cause the filepaths to recalculate and become inaccurate.
            if (this.IsVirtualAlbum)
            {
                DoAdd(galleryObject);
            }
            else
            {
                galleryObject.Parent = this;
            }
        }
开发者ID:KuduApps,项目名称:GalleryServerPro,代码行数:41,代码来源:Album.cs

示例2: GenerateThumbnailHtmlForStandardBrowser

        /// <summary>
        /// Generates the HTML to display a nicely formatted thumbnail image of the specified <paramref name="galleryObject" />, including a 
        /// border, shadows and rounded corners. This function generates a drop shadow using native CSS keywords.
        /// This works for all modern browsers except IE up until version 9, which finally added support.
        /// </summary>
        /// <param name="galleryObject">The gallery object to be used as the source for the thumbnail image.</param>
        /// <param name="gallerySettings">The gallery settings that govern display of the <paramref name="galleryObject" />.</param>
        /// <param name="includeHyperlinkToObject">if set to <c>true</c> wrap the image tag with a hyperlink so the user can click through
        /// to the media object view of the item.</param>
        /// <param name="allowAlbumTextWrapping">if set to <c>true</c> the album title is allowed to wrap to a second line if needed.
        /// Set to <c>false</c> when vertical space is limited.</param>
        /// <returns>Returns HTML that displays a nicely formatted thumbnail image of the specified <paramref name="galleryObject" /></returns>
        private static string GenerateThumbnailHtmlForStandardBrowser(IGalleryObject galleryObject, IGallerySettings gallerySettings, bool includeHyperlinkToObject, bool allowAlbumTextWrapping)
        {
            string html = String.Format(CultureInfo.InvariantCulture, @"
            {0}<div class='gsp_i_c' style='width:{1}px;'>
            {2}
                <img src='{3}' title='{4}' alt='{4}' style='width:{1}px;height:{5}px;' />
            {6}
            </div>
            ",
                                        GetAlbumText(galleryObject.Title, galleryObject.GetType(), gallerySettings, allowAlbumTextWrapping), // 0
                                        galleryObject.Thumbnail.Width, // 1
                                        GenerateHyperlinkBegin(galleryObject, gallerySettings.ThumbnailClickShowsOriginal, includeHyperlinkToObject), // 2
                                        GetThumbnailUrl(galleryObject), // 3
                                        GetHovertip(galleryObject), // 4
                                        galleryObject.Thumbnail.Height, // 5
                                        GenerateHyperlinkEnd(includeHyperlinkToObject) // 6
                );

            return html;
        }
开发者ID:xusun,项目名称:GalleryServerPro,代码行数:32,代码来源:MediaObjectHtmlBuilder.cs

示例3: GenerateUrl

        /// <summary>
        /// Generates an URL to the current web page that points to the specified <paramref name="galleryObject" /> in the query string.
        /// Examples: /dev/gs/default.aspx?moid=2, /dev/gs/default.aspx?aid=5
        /// </summary>
        /// <param name="galleryObject">The gallery object to be linked to.</param>
        /// <param name="viewOriginal">if set to <c>true</c> view the original image. Applies only for images and only when a high
        /// resolution version of the image exists.</param>
        /// <returns>Returns an URL to the current web page that points to the gallery object.</returns>
        private static string GenerateUrl(IGalleryObject galleryObject, bool viewOriginal)
        {
            string rv;

            if (galleryObject is Album)
            {
                // We have an album.
                rv = String.Concat(Utils.GetUrl(PageId.album, "aid={0}", galleryObject.Id));
            }
            else if (galleryObject is GalleryServerPro.Business.Image)
            {
                // We have an image.
                if (viewOriginal)
                    rv = String.Concat(Utils.GetUrl(PageId.mediaobject, "moid={0}&hr=1", galleryObject.Id));
                else
                    rv = String.Concat(Utils.GetUrl(PageId.mediaobject, "moid={0}", galleryObject.Id));
            }
            else
            {
                rv = String.Concat(Utils.GetUrl(PageId.mediaobject, "moid={0}", galleryObject.Id));
            }

            if (String.IsNullOrEmpty(rv))
                throw new WebException("Unsupported media object type: " + galleryObject.GetType());

            return rv;
        }
开发者ID:xusun,项目名称:GalleryServerPro,代码行数:35,代码来源:MediaObjectHtmlBuilder.cs

示例4: 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

示例5: GenerateThumbnailHtmlForIE1To8

        /// <summary>
        /// Generates the HTML to display a nicely formatted thumbnail image of the specified <paramref name="galleryObject" />, including a 
        /// border and shadows. This function generates a drop shadow using the technique described at http://www.positioniseverything.net/articles/dropshadows.html
        /// Since all other modern browsers, including IE9, support box shadows using native CSS commands, this function is only used for
        /// IE 1 to 8.
        /// </summary>
        /// <param name="galleryObject">The gallery object to be used as the source for the thumbnail image.</param>
        /// <param name="gallerySettings">The gallery settings that govern display of the <paramref name="galleryObject" />.</param>
        /// <param name="includeHyperlinkToObject">if set to <c>true</c> wrap the image tag with a hyperlink so the user can click through
        /// to the media object view of the item.</param>
        /// <param name="allowAlbumTextWrapping">if set to <c>true</c> the album title is allowed to wrap to a second line if needed.
        /// Set to <c>false</c> when vertical space is limited.</param>
        /// <returns>Returns HTML that displays a nicely formatted thumbnail image of the specified <paramref name="galleryObject" /></returns>
        private static string GenerateThumbnailHtmlForIE1To8(IGalleryObject galleryObject, IGallerySettings gallerySettings, bool includeHyperlinkToObject, bool allowAlbumTextWrapping)
        {
            string html = String.Format(CultureInfo.InvariantCulture, @"
                {0}<div class='op0' style='width:{1}px;height:{2}px;'>
                    <div class='op1'>
                        <div class='op2'>
                            <div class='sb'>
                                <div class='ib'>
                                    {3}
                                        <img src='{4}' title='{5}' alt='{5}' style='width:{6}px;height:{7}px;' />
                                    {8}
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            ",
                                        GetAlbumText(galleryObject.Title, galleryObject.GetType(), gallerySettings, allowAlbumTextWrapping), // 0
                                        galleryObject.Thumbnail.Width + 15, // 1
                                        galleryObject.Thumbnail.Height + 10, // 2
                                        GenerateHyperlinkBegin(galleryObject, gallerySettings.ThumbnailClickShowsOriginal, includeHyperlinkToObject), // 3
                                        GetThumbnailUrl(galleryObject), // 4
                                        GetHovertip(galleryObject), // 5
                                        galleryObject.Thumbnail.Width, // 6
                                        galleryObject.Thumbnail.Height, // 7
                                        GenerateHyperlinkEnd(includeHyperlinkToObject) // 8
                );

            return html;
        }
开发者ID:xusun,项目名称:GalleryServerPro,代码行数:43,代码来源:MediaObjectHtmlBuilder.cs

示例6: ShouldShowNoHiResImageMsg

        /// <summary>
        /// Gets a value indicating whether the page should display a "no hi-res image" message for the <paramref name="galleryObject"/>.
        /// Albums should never show the "no hi-res image" message, and neither should images without hi-res versions.
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>Returns true if a "no hi-res image" message should be shown; otherwise returns false.</returns>
        protected static bool ShouldShowNoHiResImageMsg(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if (galleryObject.GetType() == typeof(Album))
                return false;

            return !(DoesHiResImageExist(galleryObject.Optimized.FileName, galleryObject.Original.FileName));
        }
开发者ID:KuduApps,项目名称:GalleryServerPro,代码行数:16,代码来源:deletehires.ascx.cs

示例7: ShouldShowCheckbox

        /// <summary>
        /// Gets a value indicating whether the page should display a delete checkbox for the <paramref name="galleryObject"/>.
        /// Albums should always show the checkbox; media objects should only if an original file exists.
        /// </summary>
        /// <param name="galleryObject">The gallery object.</param>
        /// <returns>Returns true if a delete checkbox should be shown; otherwise returns false.</returns>
        protected static bool ShouldShowCheckbox(IGalleryObject galleryObject)
        {
            if (galleryObject == null)
                throw new ArgumentNullException("galleryObject");

            if (galleryObject.GetType() == typeof(Album))
                return true;

            return (DoesOriginalExist(galleryObject.Optimized.FileName, galleryObject.Original.FileName));
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:16,代码来源:deletehires.ascx.cs

示例8: GenerateUrl

		protected string GenerateUrl(IGalleryObject galleryObject)
		{
			string rv = string.Empty;

			if (galleryObject is Album)
			{
				// We have an album.
				rv = "default.aspx?aid=" + galleryObject.Id;
			}
			else if (galleryObject is GalleryServerPro.Business.Image)
			{
				// We have an image.
				if (ViewOriginal)
					rv = "default.aspx?moid=" + galleryObject.Id + "&hr=1";
				else
					rv = "default.aspx?moid=" + galleryObject.Id;
			}
			else
			{
				rv = "default.aspx?moid=" + galleryObject.Id;
			}

			if (String.IsNullOrEmpty(rv))
				throw new WebException("Unsupported media object type: " + galleryObject.GetType().ToString());

			return rv;
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:27,代码来源:thumbnailview.ascx.cs

示例9: GetSavings

		/// <summary>
		/// Calculate the potential hard drive savings, in KB, if all high res images were deleted from <paramref name="galleryObject"/>.
		/// If <paramref name="galleryObject"/> is an Album, then the value includes the sum of the size of all high res images
		/// within the album.
		/// </summary>
		/// <param name="galleryObject">The gallery object.</param>
		/// <returns>Returns the potential hard drive savings, in KB, if all high res images were deleted from <paramref name="galleryObject"/>.</returns>
		protected static string GetSavings(IGalleryObject galleryObject)
		{
			if (galleryObject.GetType() == typeof(Album))
				return String.Format("({0} KB)", GetFileSizeKbAllHiResImagesInAlbum((IAlbum)galleryObject));
			else
				return String.Format("({0} KB)", galleryObject.Original.FileSizeKB);
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:14,代码来源:deletehires.ascx.cs

示例10: ShouldShowCheckbox

		/// <summary>
		/// Gets a value indicating whether the page should display a "delete hi-res" checkbox for the <paramref name="galleryObject"/>.
		/// Albums should always show the checkbox; images should only if a hi-res image exists.
		/// </summary>
		/// <param name="galleryObject">The gallery object.</param>
		/// <returns>Returns true if a "delete hi-res" checkbox should be shown; otherwise returns false.</returns>
		protected static bool ShouldShowCheckbox(IGalleryObject galleryObject)
		{
			if (galleryObject.GetType() == typeof(Album))
				return true;

			return (DoesHiResImageExist(galleryObject.Optimized.FileName, galleryObject.Original.FileName));
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:13,代码来源:deletehires.ascx.cs

示例11: ShouldShowNoHiResImageMsg

		/// <summary>
		/// Gets a value indicating whether the page should display a "no hi-res image" message for the <paramref name="galleryObject"/>.
		/// Albums should never show the "no hi-res image" message, and neither should images without hi-res versions.
		/// </summary>
		/// <param name="galleryObject">The gallery object.</param>
		/// <returns>Returns true if a "no hi-res image" message should be shown; otherwise returns false.</returns>
		protected static bool ShouldShowNoHiResImageMsg(IGalleryObject galleryObject)
		{
			if (galleryObject.GetType() == typeof(Album))
				return false;

			return !(DoesHiResImageExist(galleryObject.Optimized.FileName, galleryObject.Original.FileName));
		}
开发者ID:haimon74,项目名称:KanNaim,代码行数:13,代码来源:deletehires.ascx.cs

示例12: Contains

        /// <summary>
        /// Determines whether the <paramref name="item"/> is already a member of the collection. An object is considered a member
        /// of the collection if one of the following scenarios is true: (1) They are both of the same type, each ID is 
        /// greater than int.MinValue, and the IDs are equal to each other, or (2) They are new objects that haven't yet
        /// been saved to the data store, the physical path to the original file has been specified, and the paths
        /// are equal to each other.
        /// </summary>
        /// <param name="item">An <see cref="IGalleryObject"/> to determine whether it is a member of the current collection.</param>
        /// <returns>Returns <c>true</c> if <paramref name="item"/> is a member of the current collection;
        /// otherwise returns <c>false</c>.</returns>
        public bool Contains(IGalleryObject item)
        {
            if (item == null)
                return false;

            foreach (IGalleryObject galleryObjectIterator in (Items.Values))
            {
                if (galleryObjectIterator == null)
                    throw new BusinessException("Error in GalleryObjectCollection.Contains method: One of the objects in the Items property is null. Items.Count = " + Items.Count);

                bool existingObjectsAndEqual = ((galleryObjectIterator.Id > int.MinValue) && (galleryObjectIterator.Id.Equals(item.Id)) && (galleryObjectIterator.GetType() == item.GetType()));

                bool newObjectsAndFilepathsAreEqual = ((galleryObjectIterator.IsNew) && (item.IsNew)
                                                                                             && (!String.IsNullOrEmpty(galleryObjectIterator.Original.FileNamePhysicalPath))
                                                                                             && (!String.IsNullOrEmpty(item.Original.FileNamePhysicalPath))
                                                                                             && (galleryObjectIterator.Original.FileNamePhysicalPath.Equals(item.Original.FileNamePhysicalPath)));

                if (existingObjectsAndEqual || newObjectsAndFilepathsAreEqual)
                {
                    return true;
                }
            }
            return false;
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:34,代码来源:GalleryObjectCollection.cs


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