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


C# IContext.WriteProgress方法代码示例

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


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

示例1: GetNodeChildren

        public override IEnumerable<INodeFactory> GetNodeChildren(IContext context)
        {               
            var nodes = new List<INodeFactory>();
            var serverName = _drive.DriveRoot;

            GetCommonNodeFactories(nodes);

            var packages = _drive.PackageProxy.Packages;
            if( ! packages.Any() )
            {
                var progress = new ProgressRecord(1, "Loading Packages", "Loading DTS Packages");
                context.WriteProgress( progress );
                var p = LoadDtsPackages(context, progress, Application, serverName, string.Empty);
                packages.AddRange(p);
                
                progress.PercentComplete = 33;
                progress.StatusDescription = "Loading SQL Packages";
                context.WriteProgress(progress);
                
                p = LoadSqlPackages(context, progress, Application, serverName, string.Empty);
                packages.AddRange(p);

                progress.PercentComplete = 66;
                progress.StatusDescription = "Loading SSISDB Catalog Packages";
                context.WriteProgress(progress); 
                
                p = LoadCatalogPackages(context, progress);
                packages.AddRange(p);                 
                packages.Sort( (q,w)=>StringComparer.InvariantCultureIgnoreCase.Compare( q.Name, w.Name) );

                progress.PercentComplete = 100;
                progress.RecordType = ProgressRecordType.Completed;
                progress.StatusDescription = "Done!";
                context.WriteProgress(progress);
            }

            nodes.Add(new CollectionNodeFactory<PackageDescriptor>("Packages", packages, a => new PackageNodeFactory(a)));
            return nodes;
        }
开发者ID:beefarino,项目名称:bips,代码行数:39,代码来源:BipsRootNodeFactory.cs

示例2: GetPackage

        public PackageDescriptor GetPackage(string path, IContext context, ProgressRecord progress)
        {
            path = path.ToLowerInvariant();
            if (!_cache.ContainsKey(path))
            {
                var events = new NullEvents();
                context.WriteDebug("Loading " + path);
                if (null != progress)
                {
                    progress.CurrentOperation = path;
                    context.WriteProgress(progress);
                }

                try
                {
                    var package = _drive.Application.LoadPackage(path, events, true);
                    var descriptor = new PackageDescriptor(package, path);
                    _cache.Add(path, descriptor);
                }
                catch(Exception e)
                {
                    /*if (!context.Force)
                    {
                        throw;
                    }*/

                    _cache.Add( path, null );
                    var errorRecord = new ErrorRecord( e, "PackageCache.GetPackage", ErrorCategory.ReadError, path);
                    context.WriteError( errorRecord );
                }
                finally
                {
                    context.WriteDebug(events.ToString());
                    context.WriteDebug("Done loading " + path);
                }
            }
            return _cache[path];
        }
开发者ID:beefarino,项目名称:bips,代码行数:38,代码来源:PackageCache.cs

示例3: GetNodeChildren

        public override IEnumerable<INodeFactory> GetNodeChildren(IContext context)
        {
            var nodes = new List<INodeFactory>();

            GetCommonNodeFactories( nodes );
            ProgressRecord progress = new ProgressRecord(9, "Package Cache", "Loading package:");
            
            if (File.Exists(_filePath))
            {
                var fileInfo = new FileInfo(_filePath);
                var package = Drive.PackageCache.GetPackage(fileInfo.FullName, context, progress);

                nodes.Add(new CollectionNodeFactory<PackageDescriptor>("Packages",
                    new[] {package}, a => new PackageNodeFactory(a)));
            }
            else if (Directory.Exists(_filePath))
            {
                var info = new DirectoryInfo(_filePath);
                var packagePaths = info.GetFiles("*.dtsx", SearchOption.TopDirectoryOnly);
                int count = packagePaths.Count();
                int i = 0;
                var packages = packagePaths.ToList().ConvertAll(e =>
                {
                    progress.PercentComplete = 100 * i++ / count;
                    progress.RecordType = ProgressRecordType.Processing;
                    return Drive.PackageCache.GetPackage(e.FullName, context, progress);
                }).Where( a=>null != a);

                nodes.Add(new CollectionNodeFactory<PackageDescriptor>("Packages", packages, a => new PackageNodeFactory(a)));
            }

            progress.RecordType = ProgressRecordType.Completed;
            progress.PercentComplete = 100;
            context.WriteProgress(progress);
            return nodes;
        }
开发者ID:beefarino,项目名称:bips,代码行数:36,代码来源:BipsFileRootNodeFactory.cs

示例4: LoadCatalogPackages

        private IEnumerable<PackageDescriptor> LoadCatalogPackages(IContext context, ProgressRecord progress)
        {
            progress.CurrentOperation = "Loading folders ...";
            context.WriteProgress(progress);

            var folders = _drive.SsisDbHelper.Folders;
            var projects = folders.ToList().ConvertAll(f => _drive.SsisDbHelper.GetProjectsForFolder(f));
            var packages = new List<PackageDescriptor>();
            foreach (var list in projects)
            {
                foreach (var item in list)
                {
                    progress.CurrentOperation = "Loading packages in project "+ item.Name +"...";
                    context.WriteProgress(progress);
                    var paths = _drive.PackageProxy.GetLocalPackageFilePathsForProject(item.Path);
                    foreach (var path in paths)
                    {                        
                        var package = _drive.PackageCache.GetPackage(path,context);
                        packages.Add( new PackageDescriptor( package.Package, item, path ));
                    }
                }                
            }

            return packages;
        }
开发者ID:beefarino,项目名称:bips,代码行数:25,代码来源:BipsRootNodeFactory.cs

示例5: LoadSqlPackages

        private static IEnumerable<PackageDescriptor> LoadSqlPackages(IContext context, ProgressRecord progressRecord, Application application, string serverName, string path)
        {
            progressRecord.CurrentOperation = "Processing SQL path " + path + "...";
            context.WriteProgress(progressRecord);

            var packageInfos = application.GetPackageInfos(path, serverName, null, null);
            var packageItems = packageInfos.Cast<PackageInfo>();
            var folders = from p in packageItems
                          where p.Flags == DTSPackageInfoFlags.Folder
                          select p;
            packageItems = from p in packageItems
                           where p.Flags == DTSPackageInfoFlags.Package
                           select p;
            var packages = packageItems.ToList()
                                       .ConvertAll(
                                           p =>application.LoadFromSqlServer(p.Folder + "\\" + p.Name, serverName, null, null, null)
                                       )
                                       .ConvertAll(p => new PackageDescriptor(p, path))
                                       .ToList();

            if (folders.Any())
            {
                var children = folders.ToList()
                    .ConvertAll(f => LoadSqlPackages(context, progressRecord, application, serverName, f.Folder + "\\" + f.Name));

                children.ForEach(packages.AddRange);
            }

            return packages;
        }
开发者ID:beefarino,项目名称:bips,代码行数:30,代码来源:BipsRootNodeFactory.cs


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