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


C# IProgressStatus类代码示例

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


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

示例1: AddinScanner

        public AddinScanner(AddinDatabase database, AddinScanResult scanResult, IProgressStatus monitor)
        {
            this.database = database;
            if (!scanResult.CheckOnly) {

                // If there is a local copy of the cecil reflector, use it instead of the one in the gac
                Type t;
                string asmFile = Path.Combine (Path.GetDirectoryName (GetType().Assembly.Location), "Mono.Addins.CecilReflector.dll");
                if (File.Exists (asmFile)) {
                    Assembly asm = Assembly.LoadFrom (asmFile);
                    t = asm.GetType ("Mono.Addins.CecilReflector.Reflector");
                }
                else {
                    string refName = GetType().Assembly.FullName;
                    int i = refName.IndexOf (',');
                    refName = "Mono.Addins.CecilReflector.Reflector, Mono.Addins.CecilReflector" + refName.Substring (i);
                    t = Type.GetType (refName, false);
                }
                if (t != null)
                    reflector = (IAssemblyReflector) Activator.CreateInstance (t);
                else
                    reflector = new DefaultAssemblyReflector ();

                if (monitor.LogLevel > 1)
                    monitor.Log ("Using assembly reflector: " + reflector.GetType ());
                reflector.Initialize (scanResult);
                coreAssembly = reflector.LoadAssembly (GetType().Assembly.Location);
            }
        }
开发者ID:NALSS,项目名称:Telegraph,代码行数:29,代码来源:AddinScanner.cs

示例2: GetProgressMonitor

		public static IProgressMonitor GetProgressMonitor (IProgressStatus status)
		{
			if (status == null)
				return new NullProgressMonitor ();
			else
				return new ProgressStatusMonitor (status);
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:7,代码来源:ProgressStatusMonitor.cs

示例3: RegisterRepository

		public AddinRepository RegisterRepository (IProgressStatus monitor, string url, bool updateNow)
		{
			if (!url.EndsWith (".mrep"))
				url = url + "/main.mrep";
			
			RepositoryRecord rr = FindRepositoryRecord (url);
			if (rr != null)
				return rr;

			RegisterRepository (url, false);
			
			try {
				if (updateNow) {
					UpdateRepository (monitor, url);
					rr = FindRepositoryRecord (url);
					Repository rep = rr.GetCachedRepository ();
					rr.Name = rep.Name;
				}
				service.SaveConfiguration ();
				return rr;
			} catch (Exception ex) {
				if (monitor != null)
					monitor.ReportError ("The repository could not be registered", ex);
				if (ContainsRepository (url))
					RemoveRepository (url);
				return null;
			}
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:28,代码来源:RepositoryRegistry.cs

示例4: ExecuteCommand

		internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string name, params string[] args)
		{
			string asm = new Uri (typeof(SetupProcess).Assembly.CodeBase).LocalPath;
			string verboseParam = monitor.VerboseLog ? "v " : "nv";
			
			Process process = new Process ();
			if (Util.IsWindows)
				process.StartInfo = new ProcessStartInfo (asm, verboseParam + " " + name + " " + string.Join (" ", args));
			else
				process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + verboseParam + " " + name + " " + string.Join (" ", args));
			process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
			process.StartInfo.UseShellExecute = false;
			process.StartInfo.RedirectStandardInput = true;
			process.StartInfo.RedirectStandardOutput = true;
			process.StartInfo.RedirectStandardError = true;
			process.EnableRaisingEvents = true;
			try {
				process.Start ();
			} catch (Exception ex) {
				Console.WriteLine (ex);
				throw;
			}
			
			process.StandardInput.WriteLine (registryPath);
			process.StandardInput.WriteLine (startupDir);
			process.StandardInput.Flush ();

//			string rr = process.StandardOutput.ReadToEnd ();
//			Console.WriteLine (rr);
			
			ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput);
			process.WaitForExit ();
			if (process.ExitCode != 0)
				throw new ProcessFailedException ();
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:35,代码来源:SetupProcess.cs

示例5: Install

		public bool Install (IProgressStatus statusMonitor, params AddinRepositoryEntry[] addins)
		{
			Package[] packages = new Package [addins.Length];
			for (int n=0; n<addins.Length; n++)
				packages [n] = AddinPackage.FromRepository (addins [n]);

			return Install (statusMonitor, packages);
		}
开发者ID:AminBonyadUni,项目名称:facedetect-f-spot,代码行数:8,代码来源:AddinStore.cs

示例6: GetPresetName

        private IList<IncludeEntry> GetPresetName(IProgressStatus progress)
        {
            string presetName = Request.QueryString["preset"] ?? "default";

            progress.ReportStatus("Using preset name {0}", MessageType.Info, presetName);

            return SerializationUtility.GetPreset(presetName);
        }
开发者ID:jelleovermars,项目名称:Unicorn,代码行数:8,代码来源:sync-database.aspx.cs

示例7: Process

        protected override void Process(IProgressStatus progress)
        {
            var configurations = ResolveConfigurations();

            foreach (var configuration in configurations)
            {
                var logger = configuration.Resolve<ILogger>();

                using (new LoggingContext(new WebConsoleLogger(progress), configuration))
                {
                    try
                    {
                        logger.Info("Control Panel Sync: Processing Unicorn configuration " + configuration.Name);

                        var beginArgs = new UnicornSyncBeginPipelineArgs(configuration);
                        CorePipeline.Run("unicornSyncBegin", beginArgs);

                        if (beginArgs.Aborted)
                        {
                            logger.Error("Unicorn Sync Begin pipeline was aborted. Not executing sync for this configuration.");
                            continue;
                        }

                        if (beginArgs.SyncIsHandled)
                        {
                            logger.Info("Unicorn Sync Begin pipeline signalled that it handled the sync for this configuration.");
                            continue;
                        }

                        var pathResolver = configuration.Resolve<PredicateRootPathResolver>();
                        var retryer = configuration.Resolve<IDeserializeFailureRetryer>();
                        var consistencyChecker = configuration.Resolve<IConsistencyChecker>();
                        var loader = configuration.Resolve<SerializationLoader>();

                        var roots = pathResolver.GetRootSerializedItems();

                        var index = 0;

                        loader.LoadAll(roots, retryer, consistencyChecker, item =>
                        {
                            progress.Report((int)(((index + 1) / (double)roots.Length) * 100));
                            index++;
                        });

                        CorePipeline.Run("unicornSyncComplete", new UnicornSyncCompletePipelineArgs(configuration));

                        logger.Info("Control Panel Sync: Completed syncing Unicorn configuration " + configuration.Name);
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }
            }

            CorePipeline.Run("unicornSyncEnd", new UnicornSyncEndPipelineArgs(configurations));
        }
开发者ID:BerserkerDotNet,项目名称:Unicorn,代码行数:58,代码来源:SyncConsole.cs

示例8: Scan

		public void Scan (IProgressStatus monitor, AddinRegistry registry, string scanFolder, string[] filesToIgnore)
		{
			AddinRegistry reg = new AddinRegistry (registry.RegistryPath, registry.StartupDirectory, registry.DefaultAddinsFolder, registry.AddinCachePath);
			reg.CopyExtensionsFrom (registry);
			StringCollection files = new StringCollection ();
			for (int n=0; n<filesToIgnore.Length; n++)
				files.Add (filesToIgnore[n]);
			reg.ScanFolders (monitor, scanFolder, files);
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:9,代码来源:SetupLocal.cs

示例9: ExecuteCommand

		internal static void ExecuteCommand (IProgressStatus monitor, string registryPath, string startupDir, string addinsDir, string databaseDir, string name, string arg1, params string[] args)
		{
			string verboseParam = monitor.LogLevel.ToString ();
			
			// Arguments string
			StringBuilder sb = new StringBuilder ();
			sb.Append (verboseParam).Append (' ').Append (name);
			sb.Append (" \"").Append (arg1).Append ("\"");
			foreach (string arg in args)
				sb.Append (" \"").Append (arg).Append ("\"");
			
			Process process = new Process ();
			
			string asm = null;
			try {
				asm = CreateHostExe ();
				if (!Util.IsMono)
					process.StartInfo = new ProcessStartInfo (asm, sb.ToString ());
				else {
					asm = asm.Replace(" ", @"\ ");
					process.StartInfo = new ProcessStartInfo ("mono", "--debug " + asm + " " + sb.ToString ());
				}
				process.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
				process.StartInfo.UseShellExecute = false;
				process.StartInfo.CreateNoWindow = true;
				process.StartInfo.RedirectStandardInput = true;
				process.StartInfo.RedirectStandardOutput = true;
				process.StartInfo.RedirectStandardError = true;
				process.EnableRaisingEvents = true;
				process.Start ();
			
				process.StandardInput.WriteLine (registryPath);
				process.StandardInput.WriteLine (startupDir);
				process.StandardInput.WriteLine (addinsDir);
				process.StandardInput.WriteLine (databaseDir);
				process.StandardInput.Flush ();
	
	//			string rr = process.StandardOutput.ReadToEnd ();
	//			Console.WriteLine (rr);
				
				StringCollection progessLog = new StringCollection ();
				ProcessProgressStatus.MonitorProcessStatus (monitor, process.StandardOutput, progessLog);
				process.WaitForExit ();
				if (process.ExitCode != 0)
					throw new ProcessFailedException (progessLog);
				
			} catch (Exception ex) {
				Console.WriteLine (ex);
				throw;
			} finally {
				if (asm != null) {
					try {
						File.Delete (asm);
					} catch { }
				}
			}
		}
开发者ID:wanglehui,项目名称:mono-addins,代码行数:57,代码来源:SetupProcess.cs

示例10: Process

        protected virtual void Process(IProgressStatus progress, ILogger additionalLogger)
        {
            var configurations = ResolveConfigurations();
            int taskNumber = 1;

            foreach (var configuration in configurations)
            {
                var logger = configuration.Resolve<ILogger>();
                var helper = configuration.Resolve<SerializationHelper>();

                using (new LoggingContext(additionalLogger, configuration))
                {
                    try
                    {
                        logger.Info(configuration.Name + " is being synced.");

                        using (new TransparentSyncDisabler())
                        {
                            var pathResolver = configuration.Resolve<PredicateRootPathResolver>();

                            var roots = pathResolver.GetRootSerializedItems();

                            var index = 0;

                            helper.SyncTree(configuration, item =>
                            {
                                WebConsoleUtility.SetTaskProgress(progress, taskNumber, configurations.Length, (int)((index / (double)roots.Length) * 100));
                                index++;
                            }, roots);
                        }
                    }
                    catch (DeserializationSoftFailureAggregateException ex)
                    {
                        logger.Error(ex);
                        // allow execution to continue, because the exception was non-fatal
                    }
                    catch (Exception ex)
                    {
                        logger.Error(ex);
                        break;
                    }
                }

                taskNumber++;
            }

            try
            {
                CorePipeline.Run("unicornSyncEnd", new UnicornSyncEndPipelineArgs(progress, configurations));
            }
            catch (Exception exception)
            {
                Log.Error("Error occurred in unicornSyncEnd pipeline.", exception);
                progress.ReportException(exception);
            }
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:56,代码来源:SyncVerb.cs

示例11: ProcessInternal

        protected virtual void ProcessInternal(IProgressStatus progress)
        {
            // this bad-ass ASCII art is from http://www.ascii-art.de/ascii/uvw/unicorn.txt - original credit to 'sk'
            const string unicorn = @"<pre>
                        /
                      .7
               \       , //
               |\.--._/|//
              /\ ) ) ).'/
             /(  \  // /       _   _ _   _ ___ ____ ___  ____  _   _
            /(   J`((_/ \     | | | | \ | |_ _/ ___/ _ \|  _ \| \ | |
               / ) | _\     /     | | | |  \| || | |  | | | | |_) |  \| |
              /|)  \  eJ    L     | |_| | |\  || | |__| |_| |  _ <| |\  |
             |  \ L \   L   L      \___/|_| \_|___\____\___/|_| \_\_| \_|
            /  \  J  `. J   L
            |  )   L   \/   \
               /  \    J   (\   /
              |  \      \   \```
            </pre>";

            // note: these logs are intentionally to progress and not loggingConsole as we don't need them in the Sitecore logs
            progress.ReportStatus(unicorn, MessageType.Warning);
            progress.ReportTransientStatus("Executing.");

            var heartbeat = new Timer(3000);
            var startTime = DateTime.Now;
            heartbeat.AutoReset = true;
            heartbeat.Elapsed += (sender, args) =>
            {
                var elapsed = Math.Round((args.SignalTime - startTime).TotalSeconds);

                progress.ReportTransientStatus("Executing for {0} sec.", elapsed.ToString(CultureInfo.InvariantCulture));
            };

            heartbeat.Start();

            try
            {
                using (new SecurityDisabler())
                {
                    using (new ItemFilterDisabler()) // disable all item filtering (if we're running in live mode we need this to get unadulterated items)
                    {
                        Process(progress);
                    }
                }
            }
            finally
            {
                heartbeat.Stop();
            }

            progress.Report(100);
            progress.ReportTransientStatus("Completed.");
            progress.ReportStatus(_isAutomatedTool ? "\r\n" : "<br>");
            progress.ReportStatus("Completed. Want to <a href=\"?verb=\">return to the control panel?</a>");
        }
开发者ID:BerserkerDotNet,项目名称:Unicorn,代码行数:56,代码来源:ControlPanelConsole.cs

示例12: Process

		protected virtual void Process(IProgressStatus progress, ILogger additionalLogger)
		{
			var configurations = ResolveConfigurations();
			int taskNumber = 1;

			foreach (var configuration in configurations)
			{
				var logger = configuration.Resolve<ILogger>();

				using (new LoggingContext(additionalLogger, configuration))
				{
					try
					{
						var timer = new Stopwatch();
						timer.Start();

						logger.Info(string.Empty);
						logger.Info(configuration.Name + " is being reserialized.");

						using (new TransparentSyncDisabler())
						{
							var targetDataStore = configuration.Resolve<ITargetDataStore>();
							var helper = configuration.Resolve<SerializationHelper>();

							// nuke any existing items in the store before we begin. This is a full reserialize so we want to
							// get rid of any existing stuff even if it's not part of existing configs
							logger.Warn("[D] Clearing existing items from {0} (if any)".FormatWith(targetDataStore.FriendlyName));
							targetDataStore.Clear();

							var roots = configuration.Resolve<PredicateRootPathResolver>().GetRootSourceItems();

							int index = 1;
							foreach (var root in roots)
							{
								helper.DumpTree(root, new[] { configuration });
								WebConsoleUtility.SetTaskProgress(progress, taskNumber, configurations.Length, (int)((index / (double)roots.Length) * 100));
								index++;
							}
						}

						timer.Stop();

						CorePipeline.Run("unicornReserializeComplete", new UnicornReserializeCompletePipelineArgs(configuration));

						logger.Info("{0} reserialization complete in {1}ms.".FormatWith(configuration.Name, timer.ElapsedMilliseconds));
					}
					catch (Exception ex)
					{
						logger.Error(ex);
						break;
					}

					taskNumber++;
				}
			}
		}
开发者ID:jnbuehler,项目名称:Unicorn,代码行数:56,代码来源:ReserializeVerb.cs

示例13: WebConsoleLogger

        public WebConsoleLogger(IProgressStatus progress, string logLevelValue)
        {
            _progress = progress;
            MessageType type;

            if(logLevelValue == null || !Enum.TryParse(logLevelValue, true, out type))
                type = MessageType.Debug;

            _logLevel = type;
        }
开发者ID:Eldblom,项目名称:Unicorn,代码行数:10,代码来源:WebConsoleLogger.cs

示例14: SetRangeTaskProgress

		/// <summary>
		/// Sets the progress of the whole based on the progress within a percentage range of the main progress (e.g. 0-100% of a task within the global range of 0-20%)
		/// </summary>
		/// <param name="progress"></param>
		/// <param name="startPercentage">The percentage the task began at</param>
		/// <param name="endPercentage">The percentage the task ends at</param>
		/// <param name="taskPercent">The percentage complete of the sub-task (0-100)</param>
		private static void SetRangeTaskProgress(IProgressStatus progress, int startPercentage, int endPercentage, int taskPercent)
		{
			int range = endPercentage - startPercentage;

			if (range <= 0) throw new ArgumentException("endPercentage must be greater than startPercentage");

			int offset = (int)Math.Round(range * (taskPercent / 100d));

			progress.Report(Math.Min(startPercentage + offset, 100));
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:17,代码来源:WebConsoleUtility.cs

示例15: SetTaskProgress

		/// <summary>
		/// Sets the progress of the whole based on the progress within a sub-task of the main progress (e.g. 0-100% of a task within the global range of 0-20%)
		/// </summary>
		/// <param name="progress"></param>
		/// <param name="taskNumber">The index of the current sub-task</param>
		/// <param name="totalTasks">The total number of sub-tasks</param>
		/// <param name="taskPercent">The percentage complete of the sub-task (0-100)</param>
		public static void SetTaskProgress(IProgressStatus progress, int taskNumber, int totalTasks, int taskPercent)
		{
			if (taskNumber < 1) throw new ArgumentException("taskNumber must be 1 or more");
			if (totalTasks < 1) throw new ArgumentException("totalTasks must be 1 or more");
			if (taskNumber > totalTasks) throw new ArgumentException("taskNumber was greater than the number of totalTasks!");

			int start = (int)Math.Round(((taskNumber - 1) / (double)totalTasks) * 100d);
			int end = start + (int)Math.Round((1d / totalTasks) * 100d);

			SetRangeTaskProgress(progress, Math.Max(start, 0), Math.Min(end, 100), taskPercent);
		}
开发者ID:hbopuri,项目名称:Unicorn,代码行数:18,代码来源:WebConsoleUtility.cs


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