Example #1
0
        public CoreSetup(IPathResolver pathResolver, IDistributedNotificationReceiver?notificationReceiver, IDispatcher uiDispatcher)
        {
            _pathResolver = pathResolver;
            var serializer = new Serializer();

            var pluginHost   = new PluginHost(uiDispatcher);
            var pluginLoader = new PluginLoader(pluginHost);

            PluginRepository = pluginLoader.LoadPlugins(pathResolver.PluginFolders);

            _configurationSerializer = new ConfigurationSerializer(serializer);
            ConfigurationBuilder     = new ConfigurationBuilder(_pathResolver, _configurationSerializer);
            Configuration            = ConfigurationBuilder.LoadConfiguration();

            ProjectProvider = new ProjectProvider(Configuration, PluginRepository);

            UserIdentityList = new UserIdentityList();

            var treeBuilder = new TreeBuilder(Configuration);

            Pipeline = new Pipeline.Pipeline(treeBuilder, Configuration, UserIdentityList);

            Pipeline.Notifier.Updated += Notifier_Updated;

            SearchEngine = new SearchEngine();
            SearchEngine.AddCriteria(new BranchCriteria(Pipeline));
            SearchEngine.AddCriteria(new DefinitionCriteria(Pipeline));
            SearchEngine.AddCriteria(new IsCriteria(Pipeline));
            SearchEngine.AddCriteria(new ForCriteria(Pipeline));
            SearchEngine.AddCriteria(new ByCriteria(Pipeline));
            SearchEngine.AddCriteria(new DuringCriteria(Pipeline));
            SearchEngine.AddCriteria(new AfterCriteria(Pipeline), false);
            SearchEngine.AddCriteria(new BeforeCriteria(Pipeline), false);

            SearchHistory = new RuntimeSearchHistory();

            if (notificationReceiver != null)
            {
                NotificationReceiver = notificationReceiver;
                NotificationReceiver.DistributedNotificationReceived += (sender, args) => DistributedNotificationReceived?.Invoke(this, args);
            }
        }