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


C# ProgressMonitor.BeginTask方法代码示例

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


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

示例1: Start

		public void Start() {
			tracker = CreateProgressMonitor ();
			tracker.BeginTask(GetDescription(), 1);

			// Sync invoke background worker which will end up doing async invoke on the internal run.
			BackgroundWorker ();
		}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:7,代码来源:VersionControlTask.cs

示例2: ProgressMonitorWrapperJob

		public ProgressMonitorWrapperJob (IAnalysisJob wrappedJob, string message)
		{
			this.wrappedJob = wrappedJob;
			monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (message, null, false);
			var work = wrappedJob.GetFiles ().Sum (f => wrappedJob.GetIssueProviders (f).Count ());
			
			monitor.BeginTask (message, work);
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:ProgressMonitorWrapperJob.cs

示例3: WriteFile

		public Task WriteFile (string file, object obj, bool saveProjects, ProgressMonitor monitor)
		{
			return Task.Run (delegate {
				Solution sol = (Solution)obj;

				try {
					monitor.BeginTask (GettextCatalog.GetString ("Saving solution: {0}", file), 1);
					WriteFileInternal (file, file, sol, saveProjects, monitor);
				} catch (Exception ex) {
					monitor.ReportError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex);
					LoggingService.LogError (GettextCatalog.GetString ("Could not save solution: {0}", file), ex);
					throw;
				} finally {
					monitor.EndTask ();
				}
			});
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:17,代码来源:SlnFileFormat.cs

示例4: ReadWorkspaceItemFile

		WorkspaceItem ReadWorkspaceItemFile (FilePath fileName, ProgressMonitor monitor)
		{
			XmlTextReader reader = new XmlTextReader (new StreamReader (fileName));
			try {
				monitor.BeginTask (string.Format (GettextCatalog.GetString ("Loading workspace item: {0}"), fileName), 1);
				reader.MoveToContent ();
				XmlDataSerializer ser = new XmlDataSerializer (MD1ProjectService.DataContext);
				ser.SerializationContext.BaseFile = fileName;
				ser.SerializationContext.ProgressMonitor = monitor;
				WorkspaceItem entry = (WorkspaceItem)ser.Deserialize (reader, typeof(WorkspaceItem));
				entry.FileName = fileName;
				return entry;
			} catch (Exception ex) {
				monitor.ReportError (string.Format (GettextCatalog.GetString ("Could not load solution item: {0}"), fileName), ex);
				throw;
			} finally {
				monitor.EndTask ();
				reader.Close ();
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:20,代码来源:WorkspaceSerializationExtension.cs

示例5: InstallEntry

		void InstallEntry (ProgressMonitor monitor, DeployContext ctx, SolutionFolderItem entry, ConfigurationSelector configuration)
		{
			foreach (DeployFile df in DeployService.GetDeployFiles (ctx, new SolutionFolderItem[] { entry }, configuration)) {
				string targetPath = df.ResolvedTargetFile;
				if (targetPath == null) {
					monitor.ReportWarning ("Could not copy file '" + df.RelativeTargetPath + "': Unknown target directory.");
					continue;
				}
				
				CopyFile (monitor, df.SourcePath, df.ResolvedTargetFile, df.FileAttributes);
			}
			
			SolutionFolder c = entry as SolutionFolder;
			if (c != null) {
				monitor.BeginTask ("Installing solution '" + c.Name + "'", c.Items.Count);
				foreach (SolutionFolderItem ce in c.Items) {
					InstallEntry (monitor, ctx, ce, configuration);
					monitor.Step (1);
				}
				monitor.EndTask ();
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:22,代码来源:InstallResolver.cs

示例6: Build

		internal bool Build (ProgressMonitor monitor)
		{
			monitor.BeginTask ("Package: " + Description, 1);
			DeployContext ctx = null;
			try {
				ctx = CreateDeployContext ();
				if (ctx != null)
					ctx.FileFilter = this;
				if (!OnBuild (monitor, ctx)) {
					return false;
				}
			} catch (Exception ex) {
				monitor.ReportError ("Package creation failed", ex);
				LoggingService.LogError ("Package creation failed", ex);
				return false;
			} finally {
				monitor.EndTask ();
				if (ctx != null)
					ctx.Dispose ();
			}
			return true;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:22,代码来源:PackageBuilder.cs

示例7: Deploy

		public Makefile Deploy (AutotoolsContext ctx, SolutionFolderItem entry, ProgressMonitor monitor)
		{
			generateAutotools = ctx.MakefileType == MakefileType.AutotoolsMakefile;
			
			monitor.BeginTask ( GettextCatalog.GetString (
						"Creating {0} for Solution {1}",
						generateAutotools ? "Makefile.am" : "Makefile", entry.Name), 1 );

			Makefile solutionMakefile = new Makefile ();
			StringBuilder solutionTop = new StringBuilder ();

			try
			{
				SolutionFolder solutionFolder = (SolutionFolder) entry;
				string targetDirectory = solutionFolder.BaseDirectory;

				StringBuilder subdirs = new StringBuilder();
				subdirs.Append ("#Warning: This is an automatically generated file, do not edit!\n");

				if (!generateAutotools) {
					solutionTop.AppendFormat ("top_srcdir={0}\n", FileService.AbsoluteToRelativePath (
							entry.BaseDirectory, ctx.TargetSolution.BaseDirectory));
					solutionTop.Append ("include $(top_srcdir)/config.make\n");
					solutionTop.Append ("include $(top_srcdir)/Makefile.include\n");
					solutionTop.Append ("include $(top_srcdir)/rules.make\n\n");
					solutionTop.Append ("#include $(top_srcdir)/custom-hooks.make\n\n");
				}

				ArrayList children = new ArrayList ();
				foreach ( SolutionConfiguration config in solutionFolder.ParentSolution.Configurations )
				{
					if ( !ctx.IsSupportedConfiguration ( config.Id ) ) continue;
					
					if (generateAutotools)
						subdirs.AppendFormat ( "if {0}\n", "ENABLE_" + ctx.EscapeAndUpperConfigName (config.Id));
					else
						subdirs.AppendFormat ( "ifeq ($(CONFIG),{0})\n", ctx.EscapeAndUpperConfigName (config.Id));

					subdirs.Append (" SUBDIRS = ");
					
					foreach (SolutionFolderItem ce in CalculateSubDirOrder (ctx, solutionFolder, config))
					{
						string baseDirectory;
						if (!(ce is SolutionItem) && !(ce is SolutionFolder))
							continue;
						
						// Ignore projects which can't be deployed
						IMakefileHandler handler = AutotoolsContext.GetMakefileHandler (ce, ctx.MakefileType);
						if (handler == null)
							continue;
							
						baseDirectory = ce.BaseDirectory;
						
						if (solutionFolder.BaseDirectory == baseDirectory) {
							subdirs.Append (" . ");
						} else {
							if (!baseDirectory.StartsWith (solutionFolder.BaseDirectory) )
								throw new Exception ( GettextCatalog.GetString (
									"Child projects must be in sub-directories of their parent") );
							
							// add the subdirectory to the list
							string path = FileService.AbsoluteToRelativePath (targetDirectory, baseDirectory);
							if (path.StartsWith ("." + Path.DirectorySeparatorChar) )
								path = path.Substring (2);
							
							AutotoolsContext.CheckSpaces (path);
							subdirs.Append (" ");
							subdirs.Append ( AutotoolsContext.EscapeStringForAutomake (path) );
						}

						if (!children.Contains (ce))
							children.Add ( ce );
					}
					subdirs.Append ( "\nendif\n" );
				}
				solutionTop.Append ( subdirs.ToString () );

				string includedProject = null;

				// deploy recursively
				foreach (SolutionFolderItem ce in children)
				{
					IMakefileHandler handler = AutotoolsContext.GetMakefileHandler ( ce, ctx.MakefileType );
					Makefile makefile;
					string outpath;
					if ( handler != null && handler.CanDeploy ( ce, ctx.MakefileType ) )
					{
						ctx.RegisterBuiltProject (ce);
						makefile = handler.Deploy ( ctx, ce, monitor );

						if (targetDirectory == ce.BaseDirectory)
						{
							if (includedProject != null)
								throw new Exception ( GettextCatalog.GetString (
									"More than 1 project in the same directory as the top-level solution is not supported."));

							// project is in the solution directory
							string projectMakefileName = ce.Name + ".make";
							includedProject = String.Format ("include {0}", projectMakefileName);
							outpath = Path.Combine (targetDirectory, projectMakefileName);
//.........这里部分代码省略.........
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:101,代码来源:SolutionMakefileHandler.cs

示例8: ReadFile

		//Reader
		public async Task<object> ReadFile (string fileName, ProgressMonitor monitor)
		{
			if (fileName == null || monitor == null)
				return null;

			var sol = new Solution (true);
			sol.FileName = fileName;
			sol.FileFormat = format;

			try {
				monitor.BeginTask (string.Format (GettextCatalog.GetString ("Loading solution: {0}"), fileName), 1);
				monitor.BeginStep ();
				await sol.OnBeginLoad ();
				var projectLoadMonitor = monitor as ProjectLoadProgressMonitor;
				if (projectLoadMonitor != null)
					projectLoadMonitor.CurrentSolution = sol;
				await Task.Factory.StartNew (() => {
					sol.ReadSolution (monitor);
				});
			} catch (Exception ex) {
				monitor.ReportError (GettextCatalog.GetString ("Could not load solution: {0}", fileName), ex);
				sol.OnEndLoad ().Wait ();
				sol.NotifyItemReady ();
				monitor.EndTask ();
				throw;
			}
			await sol.OnEndLoad ();
			sol.NotifyItemReady ();
			monitor.EndTask ();
			return sol;
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:32,代码来源:SlnFileFormat.cs

示例9: WriteFileInternal

		internal void WriteFileInternal (SlnFile sln, Solution solution, ProgressMonitor monitor)
		{
			SolutionFolder c = solution.RootFolder;

			// Delete data for projects that have been removed from the solution

			var currentProjects = new HashSet<string> (solution.GetAllItems<SolutionFolderItem> ().Select (it => it.ItemId));
			var removedProjects = new HashSet<string> ();
			if (solution.LoadedProjects != null)
				removedProjects.UnionWith (solution.LoadedProjects.Except (currentProjects));
			var unknownProjects = new HashSet<string> (sln.Projects.Select (p => p.Id).Except (removedProjects).Except (currentProjects));

			foreach (var p in removedProjects) {
				var ps = sln.Projects.GetProject (p);
				if (ps != null)
					sln.Projects.Remove (ps);
				var pc = sln.ProjectConfigurationsSection.GetPropertySet (p, true);
				if (pc != null)
					sln.ProjectConfigurationsSection.Remove (pc);
			}
			var secNested = sln.Sections.GetSection ("NestedProjects");
			if (secNested != null) {
				foreach (var np in secNested.Properties.ToArray ()) {
					if (removedProjects.Contains (np.Key) || removedProjects.Contains (np.Value))
						secNested.Properties.Remove (np.Key);
				}
			}
			solution.LoadedProjects = currentProjects;

			//Write the projects
			using (monitor.BeginTask (GettextCatalog.GetString ("Saving projects"), 1)) {
				monitor.BeginStep ();
				WriteProjects (c, sln, monitor, unknownProjects);
			}

			//FIXME: SolutionConfigurations?

			var pset = sln.SolutionConfigurationsSection;
			foreach (SolutionConfiguration config in solution.Configurations) {
				var cid = ToSlnConfigurationId (config);
				pset.SetValue (cid, cid);
			}

			WriteProjectConfigurations (solution, sln);

			//Write Nested Projects
			ICollection<SolutionFolder> folders = solution.RootFolder.GetAllItems<SolutionFolder> ().ToList ();
			if (folders.Count > 1) {
				// If folders ==1, that's the root folder
				var sec = sln.Sections.GetOrCreateSection ("NestedProjects", SlnSectionType.PreProcess);
				foreach (SolutionFolder folder in folders) {
					if (folder.IsRoot)
						continue;
					WriteNestedProjects (folder, solution.RootFolder, sec);
				}
				// Remove items which don't have a parent folder
				var toRemove = solution.GetAllItems<SolutionFolderItem> ().Where (it => it.ParentFolder == solution.RootFolder);
				foreach (var it in toRemove)
					sec.Properties.Remove (it.ItemId);
			}

			// Write custom properties for configurations
			foreach (SolutionConfiguration conf in solution.Configurations) {
				string secId = "MonoDevelopProperties." + conf.Id;
				var sec = sln.Sections.GetOrCreateSection (secId, SlnSectionType.PreProcess);
				solution.WriteConfigurationData (monitor, sec.Properties, conf);
				if (sec.IsEmpty)
					sln.Sections.Remove (sec);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:70,代码来源:SlnFileFormat.cs

示例10: Update

		static async Task Update (ProgressMonitor monitor, IEnumerator<ProjectFile> fileEnumerator, bool force, int succeeded, int warnings, int errors)
		{
			ProjectFile file = fileEnumerator.Current;
			ISingleFileCustomTool tool;
			ProjectFile genFile;

			bool shouldRun;
			while (!(shouldRun = ShouldRunGenerator (file, force, out tool, out genFile)) && fileEnumerator.MoveNext ())
				continue;

			//no files which can be generated in remaining elements of the collection, nothing to do
			if (!shouldRun) {
				WriteSummaryResults (monitor, succeeded, warnings, errors);
				return;
			}

			TaskService.Errors.ClearByOwner (file);

			var result = new SingleFileCustomToolResult ();
			monitor.BeginTask (GettextCatalog.GetString ("Running generator '{0}' on file '{1}'...", file.Generator, file.Name), 1);

			try {
				await tool.Generate (monitor, file, result);
				if (!monitor.HasErrors && !monitor.HasWarnings) {
					monitor.Log.WriteLine (GettextCatalog.GetString ("File '{0}' was generated successfully.", result.GeneratedFilePath));
					succeeded++;
				} else if (!monitor.HasErrors) {
					monitor.Log.WriteLine (GettextCatalog.GetString ("File '{0}' was generated with warnings.", result.GeneratedFilePath));
					warnings++;
				} else {
					monitor.Log.WriteLine (GettextCatalog.GetString ("Errors in file '{0}' generation.", result.GeneratedFilePath));
					errors++;
				}

				//check that we can process further. If UpdateCompleted returns `true` this means no errors or non-fatal errors occured
				if (UpdateCompleted (monitor, file, genFile, result, true) && fileEnumerator.MoveNext ())
					await Update (monitor, fileEnumerator, force, succeeded, warnings, errors);
				else
					WriteSummaryResults (monitor, succeeded, warnings, errors);
			} catch (Exception ex) {
				result.UnhandledException = ex;
				UpdateCompleted (monitor, file, genFile, result, true);
			}
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:44,代码来源:CustomToolService.cs

示例11: PopStash

		public StashApplyStatus PopStash (ProgressMonitor monitor, int stashIndex)
		{
			if (monitor != null)
				monitor.BeginTask ("Applying stash", 1);

			var stash = RootRepository.Stashes [stashIndex];
			int progress = 0;
			StashApplyStatus res = RootRepository.Stashes.Pop (stashIndex, new StashApplyOptions {
				CheckoutOptions = new CheckoutOptions {
					OnCheckoutProgress = (path, completedSteps, totalSteps) => OnCheckoutProgress (completedSteps, totalSteps, monitor, ref progress),
					OnCheckoutNotify = RefreshFile,
					CheckoutNotifyFlags = refreshFlags,
				},
			});
			NotifyFilesChangedForStash (stash);
			if (monitor != null)
				monitor.EndTask ();

			return res;
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:20,代码来源:GitRepository.cs

示例12: OnCheckoutProgress

		static void OnCheckoutProgress (int completedSteps, int totalSteps, ProgressMonitor monitor, ref int progress)
		{
			if (progress == 0 && completedSteps == 0) {
				monitor.BeginTask ("Checking out files", totalSteps);
				throttleWatch.Restart ();
			}

			int steps = completedSteps - progress;
			if (throttleWatch.ElapsedMilliseconds > progressThrottle) {
				monitor.Step (steps);
				throttleWatch.Restart ();
			}
			progress = completedSteps;

			if (completedSteps >= totalSteps) {
				monitor.EndTask ();
				throttleWatch.Stop ();
			}
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:19,代码来源:GitRepository.cs

示例13: OnTransferProgress

		static bool OnTransferProgress (TransferProgress tp, ProgressMonitor monitor, ref int progress)
		{
			if (progress == 0 && tp.ReceivedObjects == 0) {
				monitor.BeginTask ("Receiving and indexing objects", 2 * tp.TotalObjects);
				throttleWatch.Restart ();
			}

			int currentProgress = tp.ReceivedObjects + tp.IndexedObjects;
			int steps = currentProgress - progress;
			if (throttleWatch.ElapsedMilliseconds > progressThrottle) {
				monitor.Step (steps);
				throttleWatch.Restart ();
			}
			progress = currentProgress;

			if (tp.IndexedObjects >= tp.TotalObjects) {
				monitor.EndTask ();
				throttleWatch.Stop ();
			}

			return !monitor.CancellationToken.IsCancellationRequested;
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:22,代码来源:GitRepository.cs

示例14: OnMoveDirectory

		protected override void OnMoveDirectory (FilePath localSrcPath, FilePath localDestPath, bool force, ProgressMonitor monitor)
		{
			VersionInfo[] versionedFiles = GetDirectoryVersionInfo (localSrcPath, false, true);
			base.OnMoveDirectory (localSrcPath, localDestPath, force, monitor);
			monitor.BeginTask ("Moving files", versionedFiles.Length);
			foreach (VersionInfo vif in versionedFiles) {
				if (vif.IsDirectory)
					continue;
				FilePath newDestPath = vif.LocalPath.ToRelative (localSrcPath).ToAbsolute (localDestPath);
				Add (newDestPath, false, monitor);
				monitor.Step (1);
			}
			monitor.EndTask ();
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:14,代码来源:GitRepository.cs

示例15: NotifyFileChanges

		void NotifyFileChanges (ProgressMonitor monitor, TreeChanges statusList)
		{
			// Files added to source branch not present to target branch.
			var removed = statusList.Where (c => c.Status == ChangeKind.Added).Select (c => GetRepository (c.Path).FromGitPath (c.Path)).ToList ();
			var modified = statusList.Where (c => c.Status != ChangeKind.Added).Select (c => GetRepository (c.Path).FromGitPath (c.Path)).ToList ();

			monitor.BeginTask (GettextCatalog.GetString ("Updating solution"), removed.Count + modified.Count);

			FileService.NotifyFilesChanged (modified, true);
			monitor.Step (modified.Count);

			FileService.NotifyFilesRemoved (removed);
			monitor.Step (removed.Count);

			monitor.EndTask ();
		}
开发者ID:powerumc,项目名称:monodevelop_korean,代码行数:16,代码来源:GitRepository.cs


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