protected override async Task <object> InitializeToolWindowAsync(Type toolWindowType, int id, CancellationToken cancellationToken) { // Perform as much work as possible in this method which is being run on a background thread. // The object returned from this method is passed into the constructor of the SampleToolWindow var container = new SimpleIoc(); container.RegisterServices(); container.Register <IDteProvider>(() => new DteProvider(DTE)); var engineBuilder = new TexoEngineBuilder() .WithLogService(new DebugLogService()); container.RegisterEngineServices(engineBuilder); engineBuilder.WithFallbackService(container.GetInstance <IFallbackService>()); var commandFactory = new CommandFactory(); commandFactory.RegisterCommands(container); container.RegisterCommandFactory(commandFactory); var texoEngine = engineBuilder.Build(commandFactory, container.GetInstance <IViewService>()); var messageBus = container.GetInstance <IServiceMessageBus>(); container.RegisterWithMessageBus(); container.RegisterIntellisense(); var environment = container.GetInstance <IEnvironmentService>(); container.Register <ISolutionOpenStrategy>(() => new CurrentSolutionOpenStrategy(ComponentModel)); Context = new ExtensionContext( DTE, JoinableTaskFactory, texoEngine, environment, messageBus); // Register of variable strategies environment.RegisterVariableStrategy(VsVariableNames.SOLUTION_FILE, new SolutionFileStrategy(environment)); environment.RegisterVariableStrategy(VsVariableNames.SOLUTION_DIRECTORY, new SolutionDirectoryStrategy(environment)); // Register of actions texoEngine.RegisterAction(new SimpleActionFactory <UriOpenAction>(), ActionNames.URI); texoEngine.RegisterAction(new PathOpenActionFactory(Context), ActionNames.PATH_OPEN, ActionNames.PATH); texoEngine.RegisterAction(new InputSetActionFactory(container.GetInstance <IViewService>()), ActionNames.INPUT_SET, ActionNames.INPUT); await texoEngine.InitialiseWithCommandsAsync(container); texoEngine.Start(); return(Context); }
private static void StartUp() { SimpleIoc container = new SimpleIoc(); container.RegisterServices(); TexoEngineBuilder engineBuilder = new TexoEngineBuilder(); container.RegisterEngineServices(engineBuilder); CommandFactory commandFactory = new CommandFactory(); commandFactory.RegisterCommands(container); container.RegisterCommandFactory(commandFactory); engineBuilder.WithFallbackService(container.GetInstance <IFallbackService>()); TexoEngine = engineBuilder.Build(commandFactory, container.GetInstance <IViewService>()); TexoEngine.InitialiseWithCommands(); TexoEngine.Start(); }
protected override async void OnStartup(StartupEventArgs e) { base.OnStartup(e); SimpleIoc container = new SimpleIoc(); container.RegisterServices(); TexoEngineBuilder engineBuilder = new TexoEngineBuilder() .WithLogService(new DebugLogService()); container.RegisterEngineServices(engineBuilder); CommandFactory commandFactory = new CommandFactory(); commandFactory.RegisterCommands(container); container.RegisterCommandFactory(commandFactory); engineBuilder.WithFallbackService(container.GetInstance <IFallbackService>()); TexoEngine = engineBuilder.Build(commandFactory, container.GetInstance <IViewService>()); TexoEngine.RegisterAction(new SimpleActionFactory <UriOpenAction>(), ActionNames.URI); TexoEngine.RegisterAction(new PathOpenActionFactory(container.GetInstance <IExecutor>()), ActionNames.PATH_OPEN, ActionNames.PATH); TexoEngine.RegisterAction(new InputSetActionFactory(container.GetInstance <IViewService>()), ActionNames.INPUT_SET, ActionNames.INPUT); ServiceMessageBus = container.GetInstance <IServiceMessageBus>(); container.RegisterWithMessageBus(); container.RegisterIntellisense(); await TexoEngine.InitialiseWithCommandsAsync(); TexoEngine.Start(); //var searchService = container.GetInstance<ICodeBaseSearchService>(); //await searchService.PreLoadAsync(); //await searchService.LoadAsync(); }