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


C# IProgressMonitor类代码示例

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


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

示例1: CreateTextureBitmaps

        /// <summary>
        /// Creates bitmaps for the texture
        /// </summary>
        private static Bitmap[] CreateTextureBitmaps( IProgressMonitor progressMonitor, ISpherePlanet planet )
        {
            Bitmap[] faceBitmaps = new Bitmap[ 6 ];
            int width = 256;
            int height = 256;
            progressMonitor.UpdateProgress( 0 );

            ISpherePlanetTerrainRenderer renderer = planet.Renderer.GetRenderer<ISpherePlanetTerrainRenderer>( );
            if ( renderer == null )
            {
                throw new InvalidOperationException( "Expected a valid ISpherePlanetTerrainRenderer to be available" );
            }

            faceBitmaps[ ( int )CubeMapFace.PositiveX ] = renderer.CreateMarbleTextureFace( CubeMapFace.PositiveX, width, height ); progressMonitor.UpdateProgress( 1 / 6.0f );
            faceBitmaps[ ( int )CubeMapFace.NegativeX ] = renderer.CreateMarbleTextureFace( CubeMapFace.NegativeX, width, height ); progressMonitor.UpdateProgress( 2 / 6.0f );
            faceBitmaps[ ( int )CubeMapFace.PositiveY ] = renderer.CreateMarbleTextureFace( CubeMapFace.PositiveY, width, height ); progressMonitor.UpdateProgress( 3 / 6.0f );
            faceBitmaps[ ( int )CubeMapFace.NegativeY ] = renderer.CreateMarbleTextureFace( CubeMapFace.NegativeY, width, height ); progressMonitor.UpdateProgress( 4 / 6.0f );
            faceBitmaps[ ( int )CubeMapFace.PositiveZ ] = renderer.CreateMarbleTextureFace( CubeMapFace.PositiveZ, width, height ); progressMonitor.UpdateProgress( 5 / 6.0f );
            faceBitmaps[ ( int )CubeMapFace.NegativeZ ] = renderer.CreateMarbleTextureFace( CubeMapFace.NegativeZ, width, height );
            progressMonitor.UpdateProgress( 1 );

            foreach ( object cubeMapFace in Enum.GetValues( typeof( CubeMapFace ) ) )
            {
                faceBitmaps[ ( int )cubeMapFace ].Save( "PlanetCubeMap" + cubeMapFace + ".png" );
            }

            return faceBitmaps;
        }
开发者ID:johann-gambolputty,项目名称:robotbastards,代码行数:31,代码来源:SpherePlanetMarbleTextureBuilder.cs

示例2: WriteFile

		public void WriteFile (string file, object obj, MSBuildFileFormat format, bool saveProjects, IProgressMonitor monitor)
		{
			Solution sol = (Solution) obj;

			string tmpfilename = String.Empty;
			try {
				monitor.BeginTask (GettextCatalog.GetString ("Saving solution: {0}", file), 1);
				try {
					if (File.Exists (file))
						tmpfilename = Path.GetTempFileName ();
				} catch (IOException) {
				}

				string baseDir = Path.GetDirectoryName (file);
				if (tmpfilename == String.Empty) {
					WriteFileInternal (file, sol, baseDir, format, saveProjects, monitor);
				} else {
					WriteFileInternal (tmpfilename, sol, baseDir, format, saveProjects, monitor);
					FileService.SystemRename (tmpfilename, file);
				}
			} 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);

				if (!String.IsNullOrEmpty (tmpfilename) && File.Exists (tmpfilename))
					File.Delete (tmpfilename);
				throw;
			} finally {
				monitor.EndTask ();
			}
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:31,代码来源:SlnFileFormat.cs

示例3: RunImpl

        protected internal override TestResult RunImpl(ITestCommand rootTestCommand, Model.Tree.TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor)
        {
            using (progressMonitor.BeginTask("Running tests.", rootTestCommand.TestCount))
            {
                // Note: We do not check options.SkipTestExecution here because we want to build up
                // the tree of data-driven test steps.  So we actually check it later on in the
                // PatternTestExecutor.  This is different from framework adapters
                // at this time (because they do not generally support dynamically generated data-driven tests).
                Sandbox sandbox = new Sandbox();
                EventHandler canceledHandler = delegate { sandbox.Abort(TestOutcome.Canceled, "The user canceled the test run."); };
                try
                {
                    progressMonitor.Canceled += canceledHandler;

                    TestAssemblyExecutionParameters.Reset();

                    PatternTestExecutor executor = new PatternTestExecutor(options, progressMonitor, formatter, converter, environmentManager);

                    // Inlined to minimize stack depth.
                    var action = executor.CreateActionToRunTest(rootTestCommand, parentTestStep, sandbox, null);
                    action.Run();
                    return action.Result;
                }
                finally
                {
                    progressMonitor.Canceled -= canceledHandler;
                    sandbox.Dispose();
                }
            }
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:30,代码来源:PatternTestController.cs

示例4: FindReferences

		public override IEnumerable<MemberReference> FindReferences (MonoDevelop.Projects.Project project, IProjectContent content, IEnumerable<FilePath> files, IProgressMonitor monitor, IEnumerable<object> searchedMembers)
		{ // TODO: Type system conversion.
			yield break;
//			var editor = TextFileProvider.Instance.GetTextEditorData (fileName);
//			AspNetAppProject project = dom.Project as AspNetAppProject;
//			if (project == null)
//				yield break;
//			
//			var unit = AspNetParserService.GetCompileUnit (project, fileName, true);
//			if (unit == null)
//				yield break;
//			var refman = new DocumentReferenceManager (project);
//			
//			var parsedAspDocument = (AspNetParsedDocument)new AspNetParser ().Parse (dom, fileName, editor.Text);
//			refman.Doc = parsedAspDocument;
//			
//			var usings = refman.GetUsings ();
//			var documentInfo = new DocumentInfo (dom, unit, usings, refman.GetDoms ());
//			
//			var builder = new AspLanguageBuilder ();
//			
//			
//			var buildDocument = new Mono.TextEditor.TextDocument ();
//			var offsetInfos = new List<LocalDocumentInfo.OffsetInfo> ();
//			buildDocument.Text = builder.BuildDocumentString (documentInfo, editor, offsetInfos, true);
//			var parsedDocument = AspLanguageBuilder.Parse (dom, fileName, buildDocument.Text);
//			foreach (var member in searchedMembers) {
//				foreach (var reference in SearchMember (member, dom, fileName, editor, buildDocument, offsetInfos, parsedDocument)) {
//					yield return reference;
//				}
//			}
		}
开发者ID:Kalnor,项目名称:monodevelop,代码行数:32,代码来源:ASPNetReferenceFinder.cs

示例5: Initialize1

		internal void Initialize1(IProgressMonitor progressMonitor)
		{
			ICollection<ProjectItem> items = project.Items;
			ProjectService.ProjectItemAdded   += OnProjectItemAdded;
			ProjectService.ProjectItemRemoved += OnProjectItemRemoved;
			UpdateDefaultImports(items);
			// TODO: Translate me
//			progressMonitor.TaskName = "Resolving references for " + project.Name + "...";
			AbstractProject abstractProject = project as AbstractProject;
			if (abstractProject != null) {
				foreach (var reference in abstractProject.ResolveAssemblyReferences(progressMonitor.CancellationToken)) {
					if (!initializing) return; // abort initialization
					AddReference(reference, false, progressMonitor.CancellationToken);
				}
			} else {
				project.ResolveAssemblyReferences();
				AddReferencedContent(AssemblyParserService.DefaultProjectContentRegistry.Mscorlib);
				foreach (ProjectItem item in items) {
					if (!initializing) return; // abort initialization
					progressMonitor.CancellationToken.ThrowIfCancellationRequested();
					if (ItemType.ReferenceItemTypes.Contains(item.ItemType)) {
						ReferenceProjectItem reference = item as ReferenceProjectItem;
						if (reference != null) {
							AddReference(reference, false, progressMonitor.CancellationToken);
						}
					}
				}
			}
			UpdateReferenceInterDependencies();
			OnReferencedContentsChanged(EventArgs.Empty);
		}
开发者ID:dondublon,项目名称:SharpDevelop,代码行数:31,代码来源:ParseProjectContent.cs

示例6: CustomToolContext

		public CustomToolContext(IProject project, IProgressMonitor progressMonitor)
		{
			if (project == null)
				throw new ArgumentNullException("project");
			this.project = project;
			this.ProgressMonitor = progressMonitor;
		}
开发者ID:siegfriedpammer,项目名称:SharpDevelop,代码行数:7,代码来源:CustomTool.cs

示例7: FindReferencesAsync

		/// <summary>
		/// Finds all references to the specified entity.
		/// The results are reported using the callback.
		/// FindReferences may internally use parallelism, and may invoke the callback on multiple
		/// threads in parallel.
		/// </summary>
		public static async Task FindReferencesAsync(IEntity entity, IProgressMonitor progressMonitor, Action<SearchedFile> callback)
		{
			if (entity == null)
				throw new ArgumentNullException("entity");
			if (progressMonitor == null)
				throw new ArgumentNullException("progressMonitor");
			if (callback == null)
				throw new ArgumentNullException("callback");
			SD.MainThread.VerifyAccess();
			if (SD.ParserService.LoadSolutionProjectsThread.IsRunning) {
				progressMonitor.ShowingDialog = true;
				MessageService.ShowMessage("${res:SharpDevelop.Refactoring.LoadSolutionProjectsThreadRunning}");
				progressMonitor.ShowingDialog = false;
				return;
			}
			double totalWorkAmount;
			List<ISymbolSearch> symbolSearches = PrepareSymbolSearch(entity, progressMonitor.CancellationToken, out totalWorkAmount);
			double workDone = 0;
			ParseableFileContentFinder parseableFileContentFinder = new ParseableFileContentFinder();
			foreach (ISymbolSearch s in symbolSearches) {
				progressMonitor.CancellationToken.ThrowIfCancellationRequested();
				using (var childProgressMonitor = progressMonitor.CreateSubTask(s.WorkAmount / totalWorkAmount)) {
					await s.FindReferencesAsync(new SymbolSearchArgs(childProgressMonitor, parseableFileContentFinder), callback);
				}
				
				workDone += s.WorkAmount;
				progressMonitor.Progress = workDone / totalWorkAmount;
			}
		}
开发者ID:2594636985,项目名称:SharpDevelop,代码行数:35,代码来源:FindReferenceService.cs

示例8: ApplyPendingSettingsChanges

        public override void ApplyPendingSettingsChanges(IElevationContext elevationContext, IProgressMonitor progressMonitor)
        {
            base.ApplyPendingSettingsChanges(elevationContext, progressMonitor);

            optionsController.AutoSaveProject = autoSave.Checked;
            optionsController.Save();
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:ShutdownPane.cs

示例9: Execute

        protected override void Execute(IntPtr bridgeFunc, IProgressMonitor subMonitor)
        {
            using (subMonitor.BeginTask("Exploring " + File.Name, 100))
            {
                BoostTestExploreDelegate bridge =
                    (BoostTestExploreDelegate)Marshal.GetDelegateForFunctionPointer(
                        bridgeFunc,
                        typeof(BoostTestExploreDelegate)
                    );

                VisitorDelegate visitTestCase = new VisitorDelegate(VisitTestCase);
                VisitorDelegate beginVisitTestSuite = new VisitorDelegate(BeginVisitTestSuite);
                VisitorDelegate endVisitTestSuite = new VisitorDelegate(EndVisitTestSuite);

                ErrorReporterDelegate errorReporter =
                    new ErrorReporterDelegate((text) => Logger.Log(LogSeverity.Error, text));

                bridge(
                    File.FullName,

                    visitTestCase,
                    beginVisitTestSuite,
                    endVisitTestSuite,

                    errorReporter
                );

                TestModelSerializer.PublishTestModel(TestModel, MessageSink);
            }
        }
开发者ID:ndl,项目名称:Gallio.BoostAdapter,代码行数:30,代码来源:ExploreTask.cs

示例10: OnCancel

 void OnCancel(IProgressMonitor m)
 {
     lock (list) {
         foreach (IAsyncOperation operation in list)
             operation.Cancel ();
     }
 }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:7,代码来源:AggregatedOperationMonitor.cs

示例11: InstallOrUninstallWithElevationContext

        private static bool InstallOrUninstallWithElevationContext(IEnumerable<ComponentHandle<IInstaller, InstallerTraits>> installerHandles,
            IElevationContext elevationContext, IProgressMonitor progressMonitor,
            InstallerOperation operation)
        {
            foreach (var installerHandle in installerHandles)
            {
                if (progressMonitor.IsCanceled)
                    return false;

                IProgressMonitor subProgressMonitor = progressMonitor.CreateSubProgressMonitor(1);
                if (elevationContext != null && installerHandle.GetTraits().RequiresElevation)
                {
                    elevationContext.Execute(InstallerElevatedCommand.ElevatedCommandId,
                        new InstallerElevatedCommand.Arguments(installerHandle.Id, operation),
                        subProgressMonitor);
                }
                else
                {
                    IInstaller installer = installerHandle.GetComponent();

                    if (operation == InstallerOperation.Install)
                        installer.Install(progressMonitor.CreateSubProgressMonitor(1));
                    else
                        installer.Uninstall(progressMonitor.CreateSubProgressMonitor(1));
                }
            }

            return true;
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:29,代码来源:DefaultInstallerManager.cs

示例12: RunImpl

        protected override TestResult RunImpl( ITestCommand rootTestCommand, TestStep parentTestStep, TestExecutionOptions options, IProgressMonitor progressMonitor )
        {
            using(progressMonitor.BeginTask( "Verifying Specifications", rootTestCommand.TestCount ) )
            {
                if( options.SkipTestExecution )
                {
                    return SkipAll( rootTestCommand, parentTestStep );
                }
                else
                {
                    ITestContext rootContext = rootTestCommand.StartPrimaryChildStep( parentTestStep );
                    TestStep rootStep = rootContext.TestStep;
                    TestOutcome outcome = TestOutcome.Passed;

                    foreach( ITestCommand command in rootTestCommand.Children )
                    {
                        NSpecAssemblyTest assemblyTest = command.Test as NSpecAssemblyTest;
                        if( assemblyTest == null )
                            continue;

                        var assemblyResult = this.RunAssembly( command, rootStep );
                        outcome = outcome.CombineWith( assemblyResult.Outcome );
                    }

                    return rootContext.FinishStep( outcome, null );
                }
            }
        }
开发者ID:JosephJung,项目名称:NSpec,代码行数:28,代码来源:NSpecController.cs

示例13: ReadFile

        public object ReadFile(string file, IProgressMonitor monitor)
        {
            XmlTextReader reader = new XmlTextReader (new StreamReader (file));
            reader.MoveToContent ();

            string version = reader.GetAttribute ("version");
            if (version == null) version = reader.GetAttribute ("fileversion");

            DataSerializer serializer = new DataSerializer (Runtime.ProjectService.DataContext, file);
            ICombineReader combineReader = null;

            if (version == "1.0" || version == "1") {
                combineReader = new CombineReaderV1 (serializer, monitor);
                monitor.ReportWarning (string.Format (GettextCatalog.GetString ("The file '{0}' is using an old combine file format. It will be automatically converted to the current format."), file));
            }
            else if (version == "2.0")
                combineReader = new CombineReaderV2 (serializer, monitor);

            try {
                if (combineReader != null)
                    return combineReader.ReadCombine (reader);
                else
                    throw new UnknownProjectVersionException (file, version);
            } finally {
                reader.Close ();
            }
        }
开发者ID:slluis,项目名称:monodevelop-prehistoric,代码行数:27,代码来源:CmbxFileFormat.cs

示例14: GenerateInternal

		static void GenerateInternal (IProgressMonitor monitor, ProjectFile file, SingleFileCustomToolResult result)
		{
			if (file.Project.SupportedLanguages.All (l => l != "C#")) {
				const string msg = "Razor templates are only supported in C# projects";
				result.Errors.Add (new CompilerError (file.Name, -1, -1, null, msg));
				monitor.Log.WriteLine (msg);
				return;
			}

			var host = new PreprocessedRazorHost (file.FilePath);

			var defaultOutputName = file.FilePath.ChangeExtension (".cs");

			var ns = CustomToolService.GetFileNamespace (file, defaultOutputName);
			host.DefaultNamespace = ns;

			CompilerErrorCollection errors;
			var code = host.GenerateCode (out errors);
			result.Errors.AddRange (errors);

			var writer = new MonoDevelop.DesignerSupport.CodeBehindWriter ();
			writer.WriteFile (defaultOutputName, code);
			writer.WriteOpenFiles ();

			result.GeneratedFilePath = defaultOutputName;

			foreach (var err in result.Errors) {
				monitor.Log.WriteLine (err);
			}
		}
开发者ID:riverans,项目名称:monodevelop,代码行数:30,代码来源:RazorTemplatePreprocessor.cs

示例15: GetTypeUpdates

		public Dictionary<string, List<NSObjectTypeInfo>> GetTypeUpdates (IProgressMonitor monitor, CodeDomProvider provider,
			out Dictionary<string, NSObjectTypeInfo> newTypes,
			out Dictionary<string, ProjectFile> newFiles)
		{
			Dictionary<string, List<NSObjectTypeInfo>> designerFiles = new Dictionary<string, List<NSObjectTypeInfo>> ();
			string defaultNamespace;
			
			// First, we need to name any new user-defined types.
			foreach (var job in TypeSyncJobs) {
				if (!job.IsFreshlyAdded) {
					monitor.Log.WriteLine ("Found updated class: {0}", job.Type.CliName);
					continue;
				}
				
				defaultNamespace = Project.GetDefaultNamespace (job.RelativePath);
				job.Type.CliName = defaultNamespace + "." + provider.CreateValidIdentifier (job.Type.ObjCName);
				monitor.Log.WriteLine ("Found newly-added class: {0}", job.Type.CliName);
				ProjectInfo.InsertUpdatedType (job.Type);
			}
			
			// Next we can resolve base-types, outlet types, and action parameter types for each of our user-defined types.
			foreach (var job in TypeSyncJobs) {
				defaultNamespace = Project.GetDefaultNamespace (job.RelativePath);
				ProjectInfo.ResolveObjcToCli (monitor, job.Type, provider, defaultNamespace);
			}
			
			AggregateTypeUpdates (monitor, provider, designerFiles, out newTypes, out newFiles);
			MergeExistingTypes (designerFiles);
			
			return designerFiles;
		}
开发者ID:JamesChan,项目名称:monodevelop,代码行数:31,代码来源:XcodeSyncBackContext.cs


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