AllComponents
using Castle.Core.Internal;
using Castle.MicroKernel;
using Castle.Windsor.Diagnostics.DebuggerViews;
using System;
using System.Collections.Generic;
namespace Castle.Windsor.Diagnostics.Extensions
{
public class AllComponents : AbstractContainerDebuggerExtension
{
private const string name = "All components";
private IAllComponentsDiagnostic diagnostic;
public static string Name => "All components";
public override IEnumerable<DebuggerViewItem> Attach()
{
ComponentDebuggerView[] array = diagnostic.Inspect().ConvertAll(base.DefaultComponentView);
Array.Sort(array, (ComponentDebuggerView c1, ComponentDebuggerView c2) => c1.Name.CompareTo(c2.Name));
return new DebuggerViewItem[1] {
new DebuggerViewItem("All components", "Count = " + array.Length.ToString(), array)
};
}
public override void Init(IKernel kernel, IDiagnosticsHost diagnosticsHost)
{
diagnostic = new AllComponentsDiagnostic(kernel);
diagnosticsHost.AddDiagnostic(diagnostic);
}
}
}