Ejemplo n.º 1
0
        private IGlimpseRuntime GetRuntime(NancyContext context)
        {
            IGlimpseRuntime runtime;
            if (context.TryGetGlimpseRuntime(out runtime)) return runtime;

            var serviceLocator = new NancyServiceLocator(context);
            serviceLocator.Tabs = this.tabs;
            serviceLocator.Displays = this.displays;

            var factory = new Factory(serviceLocator);
            serviceLocator.Logger = factory.InstantiateLogger();
            runtime = factory.InstantiateRuntime();
            runtime.Initialize();
            context.SetGlimpseRuntime(runtime);
            context.SetGlimpseFactory(factory);
            return runtime;
        }