本文整理汇总了C#中IProgressMonitor.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressMonitor.Dispose方法的具体用法?C# IProgressMonitor.Dispose怎么用?C# IProgressMonitor.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressMonitor
的用法示例。
在下文中一共展示了IProgressMonitor.Dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteSolutionItemAsync
void ExecuteSolutionItemAsync (IProgressMonitor monitor, IBuildTarget entry, ExecutionContext context)
{
try {
OnBeforeStartProject ();
entry.Execute (monitor, context, IdeApp.Workspace.ActiveConfiguration);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
LoggingService.LogError ("Execution failed", ex);
} finally {
monitor.Dispose ();
}
}
示例2: CleanDone
void CleanDone (IProgressMonitor monitor, IBuildTarget entry, ITimeTracker tt)
{
tt.Trace ("Begin reporting clean result");
try {
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Reporting result");
monitor.ReportSuccess (GettextCatalog.GetString ("Clean successful."));
OnEndClean (monitor, tt);
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例3: UpdateCompleted
static bool UpdateCompleted (IProgressMonitor monitor, AggregatedOperationMonitor aggOp,
ProjectFile file, ProjectFile genFile, SingleFileCustomToolResult result,
bool runMultipleFiles)
{
monitor.EndTask ();
if (aggOp != null)
aggOp.Dispose ();
if (monitor.IsCancelRequested) {
monitor.ReportError (GettextCatalog.GetString ("Cancelled"), null);
monitor.Dispose ();
return false;
}
string genFileName;
try {
bool broken = false;
if (result.UnhandledException != null) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator crashed", file.Generator);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg + ": " + result.UnhandledException.Message));
monitor.ReportError (msg, result.UnhandledException);
LoggingService.LogError (msg, result.UnhandledException);
}
genFileName = result.GeneratedFilePath.IsNullOrEmpty?
null : result.GeneratedFilePath.ToRelative (file.FilePath.ParentDirectory);
if (!string.IsNullOrEmpty (genFileName)) {
bool validName = genFileName.IndexOfAny (new [] { '/', '\\' }) < 0
&& FileService.IsValidFileName (genFileName);
if (!broken && !validName) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator output invalid filename '{1}'",
file.Generator, result.GeneratedFilePath);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg));
monitor.ReportError (msg, null);
}
}
if (result.Errors.Count > 0) {
DispatchService.GuiDispatch (delegate {
foreach (CompilerError err in result.Errors)
TaskService.Errors.Add (new Task (file.FilePath, err.ErrorText, err.Column, err.Line,
err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error,
TaskPriority.Normal, file.Project.ParentSolution, file));
});
}
if (broken)
return true;
if (!runMultipleFiles) {
if (result.Success)
monitor.ReportSuccess ("Generated file successfully.");
else if (result.SuccessWithWarnings)
monitor.ReportSuccess ("Warnings in file generation.");
else
monitor.ReportError ("Errors in file generation.", null);
}
} finally {
if (!runMultipleFiles)
monitor.Dispose ();
}
if (result.GeneratedFilePath.IsNullOrEmpty || !File.Exists (result.GeneratedFilePath))
return true;
// broadcast a change event so text editors etc reload the file
FileService.NotifyFileChanged (result.GeneratedFilePath);
// add file to project, update file properties, etc
Gtk.Application.Invoke (delegate {
bool projectChanged = false;
if (genFile == null) {
genFile = file.Project.AddFile (result.GeneratedFilePath, result.OverrideBuildAction);
projectChanged = true;
} else if (result.GeneratedFilePath != genFile.FilePath) {
genFile.Name = result.GeneratedFilePath;
projectChanged = true;
}
if (file.LastGenOutput != genFileName) {
file.LastGenOutput = genFileName;
projectChanged = true;
}
if (genFile.DependsOn != file.FilePath.FileName) {
genFile.DependsOn = file.FilePath.FileName;
projectChanged = true;
}
if (projectChanged)
IdeApp.ProjectOperations.Save (file.Project);
});
return true;
//.........这里部分代码省略.........
示例4: BuildDone
void BuildDone (IProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
Task[] tasks = null;
tt.Trace ("Begin reporting build result");
try {
if (result != null) {
lastResult = result;
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
tasks = new Task [result.Errors.Count];
for (int n=0; n<tasks.Length; n++) {
tasks [n] = new Task (result.Errors [n]);
tasks [n].Owner = this;
}
TaskService.Errors.AddRange (tasks);
TaskService.Errors.ResetLocationList ();
IdeApp.Workbench.ActiveLocationList = TaskService.Errors;
tt.Trace ("Reporting result");
string errorString = GettextCatalog.GetPluralString("{0} error", "{0} errors", result.ErrorCount, result.ErrorCount);
string warningString = GettextCatalog.GetPluralString("{0} warning", "{0} warnings", result.WarningCount, result.WarningCount);
if (result.ErrorCount == 0 && result.WarningCount == 0 && lastResult.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Build successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError(GettextCatalog.GetString("Build: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError(GettextCatalog.GetString("Build failed."), null);
}
tt.Trace ("End build event");
OnEndBuild (monitor, lastResult.FailedBuildCount == 0, lastResult, entry as SolutionItem);
} else {
tt.Trace ("End build event");
OnEndBuild (monitor, false);
}
tt.Trace ("Showing results pad");
try {
Pad errorsPad = IdeApp.Workbench.GetPad<MonoDevelop.Ide.Gui.Pads.ErrorListPad> ();
switch (IdeApp.Preferences.ShowErrorPadAfterBuild) {
case BuildResultStates.Always:
if (!errorsPad.Visible)
errorsPad.IsOpenedAutomatically = true;
errorsPad.Visible = true;
errorsPad.BringToFront ();
break;
case BuildResultStates.Never:
break;
case BuildResultStates.OnErrors:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
case BuildResultStates.OnErrorsOrWarnings:
if (TaskService.Errors.Any (task => task.Severity == TaskSeverity.Error || task.Severity == TaskSeverity.Warning))
goto case BuildResultStates.Always;
goto case BuildResultStates.Never;
}
} catch {}
if (tasks != null) {
Task jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning) {
case JumpToFirst.Error:
jumpTask = tasks.FirstOrDefault (t => t.Severity == TaskSeverity.Error && TaskStore.IsProjectTaskFile (t));
break;
case JumpToFirst.ErrorOrWarning:
jumpTask = tasks.FirstOrDefault (t => (t.Severity == TaskSeverity.Error || t.Severity == TaskSeverity.Warning) && TaskStore.IsProjectTaskFile (t));
break;
}
if (jumpTask != null) {
tt.Trace ("Jumping to first result position");
jumpTask.JumpToPosition ();
}
}
} finally {
monitor.Dispose ();
tt.End ();
}
}
示例5: WriteSummaryResults
static void WriteSummaryResults (IProgressMonitor monitor, int succeeded, int warnings, int errors)
{
monitor.Log.WriteLine ();
int total = succeeded + warnings + errors;
//this might not be correct for languages where pluralization affects the other arguments
//but gettext doesn't really have an answer for sentences with multiple plurals
monitor.Log.WriteLine (
GettextCatalog.GetPluralString (
"{0} file processed total. {1} generated successfully, {2} with warnings, {3} with errors",
"{0} files processed total. {1} generated successfully, {2} with warnings, {3} with errors",
total,
total, succeeded, warnings, errors)
);
//ends the root task
monitor.EndTask ();
if (errors > 0)
monitor.ReportError (GettextCatalog.GetString ("Errors in file generation."), null);
else if (warnings > 0)
monitor.ReportSuccess (GettextCatalog.GetString ("Warnings in file generation."));
else
monitor.ReportSuccess (GettextCatalog.GetString ("Generated files successfully."));
monitor.Dispose ();
}
示例6: SignPackageDone
void SignPackageDone (IProgressMonitor monitor, BuildResult result)
{
monitor.EndTask ();
if (result != null && result.Errors.Count > 0) {
var tasks = new Task [result.Errors.Count];
for (int n = 0; n < tasks.Length; n++) {
tasks [n] = new Task (result.Errors [n], this);
}
TaskService.Errors.AddRange (tasks);
TaskService.ShowErrors ();
}
monitor.Dispose ();
}
示例7: UpdateCompleted
static void UpdateCompleted (IProgressMonitor monitor, AggregatedOperationMonitor aggOp,
ProjectFile file, ProjectFile genFile, SingleFileCustomToolResult result)
{
monitor.EndTask ();
aggOp.Dispose ();
if (monitor.IsCancelRequested) {
monitor.ReportError (GettextCatalog.GetString ("Cancelled"), null);
monitor.Dispose ();
return;
}
string genFileName;
try {
bool broken = false;
if (result.UnhandledException != null) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator crashed", file.Generator);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg + ": " + result.UnhandledException.Message));
monitor.ReportError (msg, result.UnhandledException);
LoggingService.LogError (msg, result.UnhandledException);
}
genFileName = result.GeneratedFilePath.IsNullOrEmpty?
null : result.GeneratedFilePath.ToRelative (file.FilePath.ParentDirectory);
bool validName = !string.IsNullOrEmpty (genFileName)
&& genFileName.IndexOfAny (new char[] { '/', '\\' }) < 0
&& FileService.IsValidFileName (genFileName);
if (!broken && !validName) {
broken = true;
string msg = GettextCatalog.GetString ("The '{0}' code generator output invalid filename '{1}'",
file.Generator, result.GeneratedFilePath);
result.Errors.Add (new CompilerError (file.Name, 0, 0, "", msg));
monitor.ReportError (msg, null);
}
if (result.Errors.Count > 0) {
foreach (CompilerError err in result.Errors)
TaskService.Errors.Add (new Task (file.FilePath, err.ErrorText, err.Column, err.Line,
err.IsWarning? TaskSeverity.Warning : TaskSeverity.Error,
TaskPriority.Normal, file.Project.ParentSolution, file));
}
if (broken)
return;
if (result.Success)
monitor.ReportSuccess ("Generated file successfully.");
else
monitor.ReportError ("Failed to generate file. See error pad for details.", null);
} finally {
monitor.Dispose ();
}
if (!result.GeneratedFilePath.IsNullOrEmpty && File.Exists (result.GeneratedFilePath)) {
Gtk.Application.Invoke (delegate {
if (genFile == null) {
genFile = file.Project.AddFile (result.GeneratedFilePath);
} else if (result.GeneratedFilePath != genFile.FilePath) {
genFile.Name = result.GeneratedFilePath;
}
file.LastGenOutput = genFileName;
genFile.DependsOn = file.FilePath.FileName;
IdeApp.ProjectOperations.Save (file.Project);
});
}
}
示例8: RestorePackages
void RestorePackages(IProgressMonitor progressMonitor, NuGetPackageRestoreCommandLine commandLine)
{
Runtime.ProcessService.StartConsoleProcess(
commandLine.Command,
commandLine.Arguments,
commandLine.WorkingDirectory,
progressMonitor as IConsole,
(e, sender) => progressMonitor.Dispose()
);
}
示例9: GenerateCodeCompletionDatabase
public void GenerateCodeCompletionDatabase(string createPath, IProgressMonitor progressMonitor)
{
if (progressMonitor != null)
progressMonitor.BeginTask(GettextCatalog.GetString ("Generating database"), assemblyList.Length);
for (int i = 0; i < assemblyList.Length; ++i)
{
try {
AssemblyCodeCompletionDatabase db = new AssemblyCodeCompletionDatabase (codeCompletionPath, assemblyList[i], this);
db.ParseAll ();
db.Write ();
if (progressMonitor != null)
progressMonitor.Step (1);
if (!ContinueWithProcess (progressMonitor))
return;
}
catch (Exception ex) {
Runtime.LoggingService.Info (ex);
}
}
if (progressMonitor != null) {
progressMonitor.Dispose ();
}
}