本文整理汇总了C#中MonoDevelop.Core.ProgressMonitor.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressMonitor.Dispose方法的具体用法?C# ProgressMonitor.Dispose怎么用?C# ProgressMonitor.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MonoDevelop.Core.ProgressMonitor
的用法示例。
在下文中一共展示了ProgressMonitor.Dispose方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RebuildAsync
async Task<BuildResult> RebuildAsync (IBuildTarget entry, ProgressMonitor monitor, OperationContext operationContext)
{
ITimeTracker tt = Counters.BuildItemTimer.BeginTiming ("Rebuilding " + entry.Name);
try {
OnStartClean (monitor, tt);
var res = await CleanAsync (entry, monitor, tt, true, operationContext);
if (res.HasErrors) {
tt.End ();
monitor.Dispose ();
return res;
}
if (StartBuild != null) {
BeginBuild (monitor, tt, true);
}
return await BuildSolutionItemAsync (entry, monitor, tt, operationContext:operationContext);
} finally {
tt.End ();
}
}
示例2: BuildDone
void BuildDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
TaskListEntry[] 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 TaskListEntry [result.Errors.Count];
for (int n=0; n<tasks.Length; n++) {
tasks [n] = new TaskListEntry (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 (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Build canceled."), null);
} else 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 SolutionFolderItem);
} 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.Value) {
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) {
TaskListEntry jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning.Value) {
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 ();
}
}
示例3: ExecuteSolutionItemAsync
async Task ExecuteSolutionItemAsync (ProgressMonitor monitor, IBuildTarget entry, ExecutionContext context)
{
try {
OnBeforeStartProject ();
await 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 ();
}
}
示例4: CleanDone
void CleanDone (ProgressMonitor 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 ();
}
}
示例5: WriteSummaryResults
static void WriteSummaryResults (ProgressMonitor 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: UpdateCompleted
static bool UpdateCompleted (ProgressMonitor monitor,
ProjectFile file, ProjectFile genFile, SingleFileCustomToolResult result,
bool runMultipleFiles)
{
monitor.EndTask ();
if (monitor.CancellationToken.IsCancellationRequested) {
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 TaskListEntry (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 (async 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)
await IdeApp.ProjectOperations.SaveAsync (file.Project);
});
return true;
}
示例7: ExecuteSolutionItemAsync
async Task ExecuteSolutionItemAsync (ProgressMonitor monitor, IBuildTarget entry, ExecutionContext context, ConfigurationSelector configuration, RunConfiguration runConfiguration)
{
try {
OnBeforeStartProject ();
if (entry is IRunTarget)
await ((IRunTarget)entry).Execute (monitor, context, configuration, runConfiguration);
else
await entry.Execute (monitor, context, configuration);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Execution failed."), ex);
LoggingService.LogError ("Execution failed", ex);
} finally {
monitor.Dispose ();
}
}
示例8: UpdateTranslationsAsync
void UpdateTranslationsAsync (ProgressMonitor monitor, TranslationProject project, Translation translation)
{
try {
project.UpdateTranslations (monitor, translation);
Gtk.Application.Invoke (delegate {
POEditorWidget.ReloadWidgets ();
});
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Translation update failed."), ex);
} finally {
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
monitor.Dispose ();
}
}
示例9: AddXwtFromGithubAsync
//.........这里部分代码省略.........
monitor.Step (1);
var xwt_gtk3_proj = solution.FindProjectByName ("Xwt.Gtk3") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.Gtk", "Xwt.Gtk3.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_wpf_proj = solution.FindProjectByName ("Xwt.WPF") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.WPF", "Xwt.WPF.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_mac_proj = solution.FindProjectByName ("Xwt.Mac") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.Mac", "Xwt.Mac.csproj")
) as DotNetProject;
monitor.Step (1);
var xwt_xammac_proj = solution.FindProjectByName ("Xwt.XamMac") ??
await IdeApp.ProjectOperations.AddSolutionItem (
xwt_folder,
xwt_path.Combine ("Xwt.XamMac", "Xwt.XamMac.csproj")
) as DotNetProject;
monitor.EndTask ();
monitor.Step (1);
monitor.BeginTask ("Adding Xwt References...", solution.Items.Count);
foreach (var item in solution.Items) {
var project = item as DotNetProject;
if (project != null) {
if (project.Name == newProjectName ||
project.Name.StartsWith (newProjectName + ".", StringComparison.Ordinal))
project.References.Add (ProjectReference.CreateProjectReference (xwt_proj));
if (project.Name == newProjectName + ".Desktop") {
if (Platform.IsWindows) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_wpf_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_win_proj));
} else if (Platform.IsLinux) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk3_proj));
} else if (Platform.IsMac) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_xammac_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_mac_proj));
}
}
if (project.Name == newProjectName + ".Gtk2") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_proj));
if (Platform.IsWindows) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_win_proj));
} else if (Platform.IsMac) {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk_mac_proj));
}
}
if (project.Name == newProjectName + ".Wpf") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_wpf_proj));
}
if (project.Name == newProjectName + ".Gtk3") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_gtk3_proj));
}
if (project.Name == newProjectName + ".Mac") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_mac_proj));
}
if (project.Name == newProjectName + ".XamMac") {
project.References.Add (ProjectReference.CreateProjectReference (xwt_xammac_proj));
}
}
monitor.Step (1);
}
monitor.EndTask ();
monitor.EndTask ();
monitor.ReportSuccess ("Xwt Repository initialized successfully");
await IdeApp.Workspace.SaveAsync (monitor);
} catch (Exception e) {
string msg = GettextCatalog.GetString ("Adding Xwt reference failed: ");
monitor.ReportError (msg, e);
MessageService.ShowError (msg, e);
} finally {
monitor.Dispose ();
}
}
示例10: BuildDone
void BuildDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
TaskListEntry[] 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 = ReportErrors (result);
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 (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Build canceled."), null);
} else 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 SolutionFolderItem);
} else {
tt.Trace ("End build event");
OnEndBuild (monitor, false);
}
tt.Trace ("Showing results pad");
ShowErrorsPadIfNecessary ();
if (tasks != null) {
TaskListEntry jumpTask = null;
switch (IdeApp.Preferences.JumpToFirstErrorOrWarning.Value) {
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 ();
}
}
示例11: CleanDone
void CleanDone (ProgressMonitor monitor, BuildResult result, IBuildTarget entry, ITimeTracker tt)
{
tt.Trace ("Begin reporting clean result");
try {
if (result != null) {
monitor.Log.WriteLine ();
monitor.Log.WriteLine (GettextCatalog.GetString ("---------------------- Done ----------------------"));
tt.Trace ("Updating task service");
ReportErrors (result);
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 (monitor.CancellationToken.IsCancellationRequested) {
monitor.ReportError (GettextCatalog.GetString ("Clean canceled."), null);
} else if (result.ErrorCount == 0 && result.WarningCount == 0 && result.FailedBuildCount == 0) {
monitor.ReportSuccess (GettextCatalog.GetString ("Clean successful."));
} else if (result.ErrorCount == 0 && result.WarningCount > 0) {
monitor.ReportWarning (GettextCatalog.GetString ("Clean: ") + errorString + ", " + warningString);
} else if (result.ErrorCount > 0) {
monitor.ReportError (GettextCatalog.GetString ("Clean: ") + errorString + ", " + warningString, null);
} else {
monitor.ReportError (GettextCatalog.GetString ("Clean failed."), null);
}
}
OnEndClean (monitor, tt);
tt.Trace ("Showing results pad");
ShowErrorsPadIfNecessary ();
} finally {
monitor.Dispose ();
tt.End ();
}
}