本文整理汇总了C#中IProgressMonitor.Step方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.Step方法的具体用法?C# IProgressMonitor.Step怎么用?C# IProgressMonitor.Step使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.Step方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Build
protected override BuildResult Build (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
{
DotNetProject project = entry as DotNetProject;
AddinData data = project != null ? AddinData.GetAddinData (project) : null;
if (data != null)
monitor.BeginTask (null, buildingSolution ? 2 : 3);
BuildResult res = base.Build (monitor, entry, configuration);
if (res.ErrorCount > 0 || data == null)
return res;
monitor.Step (1);
monitor.Log.WriteLine (AddinManager.CurrentLocalizer.GetString ("Verifying add-in description..."));
string fileName = data.AddinManifestFileName;
ProjectFile file = data.Project.Files.GetFile (fileName);
if (file == null)
return res;
string addinFile;
if (file.BuildAction == BuildAction.EmbeddedResource)
addinFile = project.GetOutputFileName (ConfigurationSelector.Default);
else
addinFile = file.FilePath;
AddinDescription desc = data.AddinRegistry.GetAddinDescription (new ProgressStatusMonitor (monitor), addinFile);
StringCollection errors = desc.Verify ();
foreach (string err in errors) {
res.AddError (data.AddinManifestFileName, 0, 0, "", err);
monitor.Log.WriteLine ("ERROR: " + err);
}
if (!buildingSolution && project.ParentSolution != null) {
monitor.Step (1);
SolutionAddinData sdata = project.ParentSolution.GetAddinData ();
if (sdata != null && sdata.Registry != null) {
sdata.Registry.Update (new ProgressStatusMonitor (monitor));
DispatchService.GuiDispatch (delegate {
sdata.NotifyChanged ();
});
}
}
monitor.EndTask ();
return res;
}
示例2: LoadByWorkItem
public List<WorkItem> LoadByWorkItem(IProgressMonitor progress)
{
var ids = this.clientService.GetWorkItemIds(this.query, CachedMetaData.Instance.Fields);
var list = new List<WorkItem>();
progress.BeginTask("Loading WorkItems", ids.Count);
foreach (var id in ids)
{
list.Add(clientService.GetWorkItem(id));
progress.Step(1);
}
progress.EndTask();
return list;
}
示例3: LoadByPage
public List<WorkItem> LoadByPage(IProgressMonitor progress)
{
var ids = this.clientService.GetWorkItemIds(this.query, CachedMetaData.Instance.Fields);
int pages = (int)Math.Ceiling((double)ids.Count / (double)50);
var result = new List<WorkItem>();
progress.BeginTask("Loading WorkItems", pages);
for (int i = 0; i < pages; i++)
{
var idList = new List<int>(ids.Skip(i * 50).Take(50));
var items = this.clientService.PageWorkitemsByIds(this.query, idList);
result.AddRange(items);
progress.Step(1);
}
progress.EndTask();
return result;
}
示例4: GetFileNames
public IEnumerable<Tuple<ProjectDom, FilePath>> GetFileNames(Solution solution, ProjectDom dom, ICompilationUnit unit, IProgressMonitor monitor)
{
int counter = 0;
ReadOnlyCollection<Project> allProjects = solution.GetAllProjects();
if (monitor != null)
monitor.BeginTask(GettextCatalog.GetString("Finding references in solution..."),
allProjects.Sum<Project>(p => p.Files.Count));
foreach (Project project in allProjects) {
if (monitor != null && monitor.IsCancelRequested) yield break;
ProjectDom currentDom = ProjectDomService.GetProjectDom(project);
foreach (ProjectFile projectFile in (Collection<ProjectFile>) project.Files) {
if (monitor != null && monitor.IsCancelRequested) yield break;
yield return Tuple.Create<ProjectDom, FilePath>(currentDom, projectFile.FilePath);
if (monitor != null) {
if (counter % 10 == 0) monitor.Step(10);
++counter;
}
}
}
if (monitor != null) monitor.EndTask();
}
示例5: InstallEntry
void InstallEntry (IProgressMonitor monitor, DeployContext ctx, SolutionItem entry, ConfigurationSelector configuration)
{
foreach (DeployFile df in DeployService.GetDeployFiles (ctx, new SolutionItem[] { 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 (SolutionItem ce in c.Items) {
InstallEntry (monitor, ctx, ce, configuration);
monitor.Step (1);
}
monitor.EndTask ();
}
}
示例6: LoadSolutionItem
protected override SolutionEntityItem LoadSolutionItem (IProgressMonitor monitor, string fileName)
{
SolutionEntityItem entry = base.LoadSolutionItem (monitor, fileName);
if (entry == null)
return null;
Project project = entry as Project;
if (project == null)
return entry;
//Project
MakefileData data = entry.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null)
return entry;
monitor.BeginTask (GettextCatalog.GetString ("Updating project from Makefile"), 1);
try {
data.OwnerProject = project;
if (data.SupportsIntegration)
data.UpdateProject (monitor, false);
monitor.Step (1);
} catch (Exception e) {
monitor.ReportError (GettextCatalog.GetString (
"Error loading Makefile for project {0}", project.Name), e);
} finally {
monitor.EndTask ();
}
entry.SetNeedsBuilding (false);
return entry;
}
示例7: Clean
protected override void Clean (IProgressMonitor monitor, SolutionEntityItem entry, ConfigurationSelector configuration)
{
Project proj = entry as Project;
if (proj == null) {
base.Clean (monitor, entry, configuration);
return;
}
MakefileData data = proj.ExtendedProperties ["MonoDevelop.Autotools.MakefileInfo"] as MakefileData;
if (data == null || !data.SupportsIntegration || String.IsNullOrEmpty (data.CleanTargetName)) {
base.Clean (monitor, entry, configuration);
return;
}
monitor.BeginTask (GettextCatalog.GetString ("Cleaning project"), 1);
try {
string baseDir = proj.BaseDirectory;
ProcessWrapper process = Runtime.ProcessService.StartProcess (data.AbsoluteMakeCommand,
data.CleanTargetName,
baseDir,
monitor.Log,
monitor.Log,
null);
process.WaitForOutput ();
if (process.ExitCode > 0)
throw new Exception ( GettextCatalog.GetString ("An unspecified error occurred while running '{0} {1}'", data.AbsoluteMakeCommand, data.CleanTargetName) );
monitor.Step (1);
} catch (Exception e) {
monitor.ReportError (GettextCatalog.GetString ("Project could not be cleaned: "), e);
return;
} finally {
monitor.EndTask ();
}
monitor.ReportSuccess (GettextCatalog.GetString ("Project successfully cleaned"));
}
示例8: CompileXIBFiles
/// <summary>
/// Compiles the XIB files.
/// </summary>
/// <param name = 'monitor'>The progress monitor.</param>
/// <param name = 'project'>The project.</param>
/// <param name = 'maker'>The bundle maker.</param>
/// <param name = 'result'>The build result.</param>
public static void CompileXIBFiles(IProgressMonitor monitor, MonobjcProject project, BundleMaker maker, BuildResult result)
{
XibCompiler xibCompiler = new XibCompiler ();
IEnumerable<FilePair> files = project.GetIBFiles (Constants.InterfaceDefinition, maker.ResourcesFolder);
if (files == null || files.Count() == 0) {
return;
}
List<FilePair> pairs = new List<FilePair> (files);
monitor.BeginTask (GettextCatalog.GetString ("Compiling XIB files..."), files.Count ());
foreach (FilePair pair in pairs) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Compiling {0}", pair.Source.ToRelative (project.BaseDirectory)));
xibCompiler.Logger = new BuildLogger (pair.Source, monitor, result);
xibCompiler.Compile (pair.Source, pair.DestinationDir);
monitor.Step (1);
}
monitor.EndTask ();
}
示例9: EncryptContentFiles
/// <summary>
/// Combines the artwork.
/// </summary>
public static void EncryptContentFiles(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
{
IEnumerable<FilePair> files = project.GetEncryptedContentFiles (configuration, maker.ResourcesFolder);
if (files == null || files.Count() == 0) {
return;
}
Aes provider = FileEncrypter.GetProvider (project.EncryptionSeed);
monitor.BeginTask (GettextCatalog.GetString ("Encrypting content files..."), files.Count ());
foreach (FilePair pair in files) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Encrypting {0}", pair.Source.ToRelative (project.BaseDirectory)));
pair.Encrypt(provider);
monitor.Step (1);
}
monitor.EndTask ();
}
示例10: CopyOutputFiles
/// <summary>
/// Copies the content files.
/// </summary>
/// <param name = 'monitor'>The progress monitor.</param>
/// <param name = 'project'>The project.</param>
/// <param name = 'configuration'>The configuration.</param>
/// <param name = 'maker'>The bundle maker.</param>
public static void CopyOutputFiles(IProgressMonitor monitor, MonobjcProject project, ConfigurationSelector configuration, BundleMaker maker)
{
IEnumerable<FilePair> files = project.GetOutputFiles (configuration, maker.ResourcesFolder);
if (files == null || files.Count() == 0) {
return;
}
monitor.BeginTask (GettextCatalog.GetString ("Copying output files..."), files.Count ());
foreach (FilePair pair in files) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Copying {0}", pair.Source.ToRelative (project.BaseDirectory)));
pair.Copy (false);
monitor.Step (1);
}
monitor.EndTask ();
}
示例11: Initialize
public static void Initialize (IProgressMonitor monitor)
{
Counters.Initialization.Trace ("Creating Workbench");
workbench = new Workbench ();
Counters.Initialization.Trace ("Creating Root Workspace");
workspace = new RootWorkspace ();
Counters.Initialization.Trace ("Creating Services");
projectOperations = new ProjectOperations ();
helpOperations = new HelpOperations ();
commandService = new CommandManager ();
ideServices = new IdeServices ();
CustomToolService.Init ();
AutoTestService.Start (commandService, Preferences.EnableAutomatedTesting);
commandService.CommandTargetScanStarted += CommandServiceCommandTargetScanStarted;
commandService.CommandTargetScanFinished += CommandServiceCommandTargetScanFinished;
KeyBindingService.LoadBindingsFromExtensionPath ("/MonoDevelop/Ide/KeyBindingSchemes");
KeyBindingService.LoadCurrentBindings ("MD2");
commandService.CommandError += delegate (object sender, CommandErrorArgs args) {
MessageService.ShowException (args.Exception, args.ErrorMessage);
};
FileService.ErrorHandler = FileServiceErrorHandler;
monitor.BeginTask (GettextCatalog.GetString("Loading Workbench"), 5);
Counters.Initialization.Trace ("Loading Commands");
commandService.LoadCommands ("/MonoDevelop/Ide/Commands");
monitor.Step (1);
Counters.Initialization.Trace ("Initializing Workbench");
workbench.Initialize (monitor);
monitor.Step (1);
InternalLog.EnableErrorNotification ();
monitor.Step (1);
Counters.Initialization.Trace ("Restoring Workbench State");
workbench.Show ("SharpDevelop.Workbench.WorkbenchMemento");
monitor.Step (1);
Counters.Initialization.Trace ("Flushing GUI events");
DispatchService.RunPendingEvents ();
Counters.Initialization.Trace ("Flushed GUI events");
MessageService.RootWindow = workbench.RootWindow;
commandService.EnableIdleUpdate = true;
// Default file format
MonoDevelop.Projects.Services.ProjectServiceLoaded += delegate(object sender, EventArgs e) {
((ProjectService)sender).DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat;
};
IdeApp.Preferences.DefaultProjectFileFormatChanged += delegate {
IdeApp.Services.ProjectService.DefaultFileFormatId = IdeApp.Preferences.DefaultProjectFileFormat;
};
// Perser service initialization
MonoDevelop.Projects.Dom.Parser.ProjectDomService.TrackFileChanges = true;
MonoDevelop.Projects.Dom.Parser.ProjectDomService.ParseProgressMonitorFactory = new ParseProgressMonitorFactory ();
// Startup commands
Counters.Initialization.Trace ("Running Startup Commands");
AddinManager.AddExtensionNodeHandler ("/MonoDevelop/Ide/StartupHandlers", OnExtensionChanged);
monitor.EndTask ();
// Set initial run flags
Counters.Initialization.Trace ("Upgrading Settings");
if (PropertyService.Get("MonoDevelop.Core.FirstRun", false)) {
isInitialRun = true;
PropertyService.Set ("MonoDevelop.Core.FirstRun", false);
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion);
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", CurrentRevision);
PropertyService.SaveProperties ();
}
string lastVersion = PropertyService.Get ("MonoDevelop.Core.LastRunVersion", "1.9.1");
int lastRevision = PropertyService.Get ("MonoDevelop.Core.LastRunRevision", 0);
if (lastRevision != CurrentRevision && !isInitialRun) {
isInitialRunAfterUpgrade = true;
if (lastRevision == 0) {
switch (lastVersion) {
case "1.0": lastRevision = 1; break;
case "2.0": lastRevision = 2; break;
case "2.2": lastRevision = 3; break;
case "2.2.1": lastRevision = 4; break;
}
}
upgradedFromRevision = lastRevision;
PropertyService.Set ("MonoDevelop.Core.LastRunVersion", BuildVariables.PackageVersion);
PropertyService.Set ("MonoDevelop.Core.LastRunRevision", CurrentRevision);
PropertyService.SaveProperties ();
}
//.........这里部分代码省略.........
示例12: UpdateTranslations
public void UpdateTranslations (IProgressMonitor monitor, params Translation[] translations)
{
monitor.BeginTask (null, Translations.Count + 1);
try {
List<Project> projects = new List<Project> ();
foreach (Project p in ParentSolution.GetAllProjects ()) {
if (IsIncluded (p))
projects.Add (p);
}
monitor.BeginTask (GettextCatalog.GetString ("Updating message catalog"), projects.Count);
CreateDefaultCatalog (monitor);
monitor.Log.WriteLine (GettextCatalog.GetString ("Done"));
} finally {
monitor.EndTask ();
monitor.Step (1);
}
if (monitor.IsCancelRequested) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Operation cancelled."));
return;
}
Dictionary<string, bool> isIncluded = new Dictionary<string, bool> ();
foreach (Translation translation in translations) {
isIncluded[translation.IsoCode] = true;
}
foreach (Translation translation in this.Translations) {
if (!isIncluded.ContainsKey (translation.IsoCode))
continue;
string poFileName = translation.PoFile;
monitor.BeginTask (GettextCatalog.GetString ("Updating {0}", translation.PoFile), 1);
try {
var pb = new ProcessArgumentBuilder ();
pb.Add ("-U");
pb.AddQuoted (poFileName);
pb.Add ("-v");
pb.AddQuoted (this.BaseDirectory.Combine ("messages.po"));
var process = Runtime.ProcessService.StartProcess (Translation.GetTool ("msgmerge"),
pb.ToString (), this.BaseDirectory, monitor.Log, monitor.Log, null);
process.WaitForOutput ();
}
catch (System.ComponentModel.Win32Exception) {
var msg = GettextCatalog.GetString ("Did not find msgmerge. Please ensure that gettext tools are installed.");
monitor.ReportError (msg, null);
}
catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Could not update file {0}", translation.PoFile), ex);
}
finally {
monitor.EndTask ();
monitor.Step (1);
}
if (monitor.IsCancelRequested) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Operation cancelled."));
return;
}
}
}
示例13: CreateDefaultCatalog
void CreateDefaultCatalog (IProgressMonitor monitor)
{
IFileScanner[] scanners = TranslationService.GetFileScanners ();
Catalog catalog = new Catalog (this);
List<Project> projects = new List<Project> ();
foreach (Project p in ParentSolution.GetAllProjects ()) {
if (IsIncluded (p))
projects.Add (p);
}
foreach (Project p in projects) {
monitor.Log.WriteLine (GettextCatalog.GetString ("Scanning project {0}...", p.Name));
foreach (ProjectFile file in p.Files) {
if (!File.Exists (file.FilePath))
continue;
if (file.Subtype == Subtype.Code) {
string mimeType = DesktopService.GetMimeTypeForUri (file.FilePath);
foreach (IFileScanner fs in scanners) {
if (fs.CanScan (this, catalog, file.FilePath, mimeType))
fs.UpdateCatalog (this, catalog, monitor, file.FilePath);
}
}
}
if (monitor.IsCancelRequested)
return;
monitor.Step (1);
}
catalog.Save (Path.Combine (this.BaseDirectory, "messages.po"));
}
示例14: AddNewTranslation
public Translation AddNewTranslation (string isoCode, IProgressMonitor monitor)
{
try {
Translation tr = new Translation (this, isoCode);
translations.Add (tr);
string templateFile = Path.Combine (this.BaseDirectory, "messages.po");
string translationFile = GetFileName (isoCode);
if (!File.Exists (templateFile))
CreateDefaultCatalog (monitor);
File.Copy (templateFile, translationFile);
monitor.ReportSuccess (String.Format (GettextCatalog.GetString ("Language '{0}' successfully added."), isoCode));
monitor.Step (1);
this.Save (monitor);
return tr;
} catch (Exception e) {
monitor.ReportError (String.Format ( GettextCatalog.GetString ("Language '{0}' could not be added: "), isoCode), e);
return null;
} finally {
monitor.EndTask ();
}
}
示例15: Save
public void Save (IProgressMonitor monitor)
{
if (HasSlnData && !SavingSolution && Item.ParentSolution != null) {
// The project has data that has to be saved in the solution, but the solution is not being saved. Do it now.
monitor.BeginTask (null, 2);
SaveItem (monitor);
monitor.Step (1);
Solution sol = Item.ParentSolution;
SolutionFormat.SlnFileFormat.WriteFile (sol.FileName, sol, SolutionFormat, false, monitor);
sol.NeedsReload = false;
monitor.EndTask ();
} else
SaveItem (monitor);
}