protected override void OnStartup(StartupEventArgs a) { try { base.OnStartup(a); // Composition root var app = new FileMakerView(); app.Context = new FileMakerViewModel( new FileCreator.Creator( new CompositeTrace( new ErrorPrompterTrace(e => e.Level <= app.Context.TraceLevel), QdxSystemTraceAdapter.ForType <FileMakerView>(), new ReallyBasicErrorLogger(e => e.Level <= app.Context.TraceLevel))) { SecureTrace = new ReallyBasicErrorLogger(e => e.Level <= app.Context.TraceLevel) }) { NumberFiles = 10, SelectedDirectory = $"{Directory.GetCurrentDirectory().TrimEnd('\\')}\\", TraceLevel = TraceLevel.Error }; app.InitializeComponent(); app.Show(); } catch (Exception e) // App entry point is one of the few places a Pokemon handler is OK { Trace.Critical(e); Environment.FailFast(e.Message, e); } }
public ITrace BuildTraceFor <T>() { return (new CompositeTrace( ConsoleLogger, // A singleton -- all components log through here ReallyBasicErrorLogger, // A singleton -- all components log through here QdxSystemTraceAdapter.ForType <T>())); // New for each component. }