本文整理汇总了C#中ITimeTracker类的典型用法代码示例。如果您正苦于以下问题:C# ITimeTracker类的具体用法?C# ITimeTracker怎么用?C# ITimeTracker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITimeTracker类属于命名空间,在下文中一共展示了ITimeTracker类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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 ();
}
}
示例2: OnEndClean
void OnEndClean (IProgressMonitor monitor, ITimeTracker tt)
{
tt.Trace ("End clean event");
if (EndClean != null) {
EndClean (this, new CleanEventArgs (monitor));
}
}
示例3: CleanAsync
void CleanAsync (IBuildTarget entry, IProgressMonitor monitor, ITimeTracker tt, bool isRebuilding)
{
try {
tt.Trace ("Cleaning item");
SolutionItem it = entry as SolutionItem;
if (it != null) {
it.Clean (monitor, IdeApp.Workspace.ActiveConfiguration);
}
else {
entry.RunTarget (monitor, ProjectService.CleanTarget, IdeApp.Workspace.ActiveConfiguration);
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Clean failed."), ex);
} finally {
tt.Trace ("Done cleaning");
}
if (isRebuilding) {
if (EndClean != null) {
DispatchService.GuiSyncDispatch (() => OnEndClean (monitor, tt));
}
} else {
DispatchService.GuiDispatch (() => CleanDone (monitor, entry, tt));
}
}
示例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: OnStartClean
void OnStartClean (IProgressMonitor monitor, ITimeTracker tt)
{
tt.Trace ("Start clean event");
TaskService.Errors.ClearByOwner (this);
if (StartClean != null) {
StartClean (this, new CleanEventArgs (monitor));
}
}
示例6: BuildSolutionItemAsync
void BuildSolutionItemAsync (IBuildTarget entry, IProgressMonitor monitor, ITimeTracker tt)
{
BuildResult result = null;
try {
tt.Trace ("Pre-build operations");
result = DoBeforeCompileAction ();
if (result.ErrorCount == 0) {
tt.Trace ("Building item");
SolutionItem it = entry as SolutionItem;
if (it != null)
result = it.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true);
else
result = entry.RunTarget (monitor, ProjectService.BuildTarget, IdeApp.Workspace.ActiveConfiguration);
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
} finally {
tt.Trace ("Done building");
}
DispatchService.GuiDispatch (
delegate {
BuildDone (monitor, result, entry, tt); // BuildDone disposes the monitor
});
}
示例7: BeginBuild
void BeginBuild (IProgressMonitor monitor, ITimeTracker tt, bool isRebuilding)
{
tt.Trace ("Start build event");
if (!isRebuilding) {
TaskService.Errors.ClearByOwner (this);
}
if (StartBuild != null) {
StartBuild (this, new BuildEventArgs (monitor, true));
}
}
示例8: BuildSolutionItemAsync
void BuildSolutionItemAsync (IBuildTarget entry, IProgressMonitor monitor, ITimeTracker tt, bool skipPrebuildCheck = false, ProjectOperationContext context = null)
{
BuildResult result = null;
try {
if (!skipPrebuildCheck) {
tt.Trace ("Pre-build operations");
result = DoBeforeCompileAction ();
}
//wait for any custom tools that were triggered by the save, since the build may depend on them
MonoDevelop.Ide.CustomTools.CustomToolService.WaitForRunningTools (monitor);
if (skipPrebuildCheck || result.ErrorCount == 0) {
tt.Trace ("Building item");
SolutionItem it = entry as SolutionItem;
if (it != null)
result = it.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true, context);
else if (entry is WorkspaceItem)
result = ((WorkspaceItem)entry).Build (monitor, IdeApp.Workspace.ActiveConfiguration, context);
else
result = entry.RunTarget (monitor, ProjectService.BuildTarget, IdeApp.Workspace.ActiveConfiguration);
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
if (result == null)
result = new BuildResult ();
result.AddError ("Build failed. See the build log for details.");
if (result.SourceTarget == null)
result.SourceTarget = entry;
} finally {
tt.Trace ("Done building");
}
DispatchService.GuiDispatch (
delegate {
BuildDone (monitor, result, entry, tt); // BuildDone disposes the monitor
});
}
示例9: BuildSolutionItemAsync
async Task<BuildResult> BuildSolutionItemAsync (IBuildTarget entry, ProgressMonitor monitor, ITimeTracker tt, bool skipPrebuildCheck = false, OperationContext operationContext = null)
{
BuildResult result = null;
try {
if (!skipPrebuildCheck) {
tt.Trace ("Pre-build operations");
result = DoBeforeCompileAction ();
}
//wait for any custom tools that were triggered by the save, since the build may depend on them
await MonoDevelop.Ide.CustomTools.CustomToolService.WaitForRunningTools (monitor);
if (skipPrebuildCheck || result.ErrorCount == 0) {
tt.Trace ("Building item");
result = await entry.Build (monitor, IdeApp.Workspace.ActiveConfiguration, true, operationContext);
}
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Build failed."), ex);
if (result == null)
result = new BuildResult ();
result.AddError ("Build failed. See the build log for details.");
if (result.SourceTarget == null)
result.SourceTarget = entry;
} finally {
tt.Trace ("Done building");
}
BuildDone (monitor, result, entry, tt); // BuildDone disposes the monitor
return result;
}
示例10: CleanAsync
async Task<BuildResult> CleanAsync (IBuildTarget entry, ProgressMonitor monitor, ITimeTracker tt, bool isRebuilding, OperationContext operationContext)
{
BuildResult res = null;
try {
tt.Trace ("Cleaning item");
res = await entry.Clean (monitor, IdeApp.Workspace.ActiveConfiguration, operationContext);
} catch (Exception ex) {
monitor.ReportError (GettextCatalog.GetString ("Clean failed."), ex);
} finally {
tt.Trace ("Done cleaning");
}
if (isRebuilding) {
if (EndClean != null) {
OnEndClean (monitor, tt);
}
} else {
CleanDone (monitor, entry, tt);
}
return res;
}
示例11: 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 ();
}
}
示例12: 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 ();
}
}
示例13: CommandServiceCommandTargetScanStarted
static void CommandServiceCommandTargetScanStarted (object sender, EventArgs e)
{
commandTimeCounter = Counters.CommandTargetScanTime.BeginTiming ();
}
示例14: BackgroundInitialize
void BackgroundInitialize (object state)
{
timer = Counters.TargetRuntimesLoading.BeginTiming ("Initializing Runtime " + Id);
lock (initLock) {
try {
RunInitialization ();
} catch (Exception ex) {
LoggingService.LogInternalError ("Unhandled exception in SystemAssemblyService background initialisation thread.", ex);
} finally {
lock (initEventLock) {
initializing = false;
initialized = true;
try {
if (initializedEvent != null && !ShuttingDown)
initializedEvent (this, EventArgs.Empty);
} catch (Exception ex) {
LoggingService.LogError ("Error while initializing the runtime: " + Id, ex);
}
}
timer.End ();
}
}
}