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


C# IAlbum.SortAsync方法代码示例

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


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

示例1: Synchronize

        /// <summary>
        /// Synchronize the media object library, starting with the root album. Optionally specify that only the 
        /// specified album is synchronized. If <see cref="IsRecursive" /> = true, then child albums are recursively synchronized;
        /// otherwise, only the root album (or the specified album if that overload is used) is synchronized.
        /// </summary>
        /// <param name="synchId">A GUID that uniquely identifies the synchronization. If another synchronization is in 
        /// progress, a <see cref="GalleryServerPro.Events.CustomExceptions.SynchronizationInProgressException" /> exception is thrown.</param>
        /// <param name="userName">The user name for the logged on user. This is used for the audit fields in the album 
        /// and media objects.</param>
        /// <param name="album">The album to synchronize.</param>
        /// <exception cref="GalleryServerPro.Events.CustomExceptions.SynchronizationInProgressException">
        /// Thrown if another synchronization is in progress.</exception>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="album" /> is null.</exception>
        public void Synchronize(string synchId, IAlbum album, string userName)
        {
            if (album == null)
                throw new ArgumentNullException("album");

            try
            {
                Initialize(synchId, album, userName); // Will throw SynchronizationInProgressException if another is in progress. Will be caught be upstream code.

                var albumDirectory = new DirectoryInfo(album.FullPhysicalPathOnDisk);

                // Synchronize the files in this album. No recursive action.
                SynchronizeMediaObjectFiles(albumDirectory, album);

                if (IsRecursive)
                {
                    // Synchronize the child directories and their files. Acts recursively.
                    SynchronizeChildDirectories(albumDirectory, album);
                }

                Album.AssignAlbumThumbnail(album, false, true, UserName);

                album.SortAsync(true, UserName, true);

                if (_synchStatus != null)
                    _synchStatus.Finish();
            }
            catch (SynchronizationTerminationRequestedException)
            {
                // The user has canceled the synchronization. Swallow the exception and return.
                return;
            }
            catch (SynchronizationInProgressException)
            {
                // Another sync is in progress. We don't want the generic catch below to change the sync state, so we intercept it here.
                throw;
            }
            catch
            {
                if (_synchStatus != null)
                    UpdateStatus(0, syncState: SynchronizationState.Error, persistToDatabase: true);

                throw;
            }
            finally
            {
                HelperFunctions.PurgeCache();
            }
        }
开发者ID:Jiyuu,项目名称:galleryserverpro,代码行数:62,代码来源:SynchronizationManager.cs


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