protected override async void OnInitialize()
        {
            var results = await hubbClient.SearchAsync("caliburn");

            Repositories.AddRange(results);

            eventAggregator.PublishOnUIThread(new RepositorySelectedMessage(Repositories[0]));
        }
Exemple #2
0
        public async void Search()
        {
            Repositories.Clear();

            var repositories = await _gitHubClient.Search.SearchRepo(new SearchRepositoriesRequest(Term));

            Repositories.AddRange(repositories.Items);
        }
        private async void Loaded()
        {
            List <RepositoryViewModel> tmpRepositories = null;
            List <LauncherViewModel>   tmpLaunchers    = null;
            await Task.Run(() =>
            {
                tmpRepositories = GetRepositories();
                tmpLaunchers    = GetLaunchers();
            });

            Repositories.Clear();
            Repositories.AddRange(tmpRepositories);

            Launchers.Clear();
            Launchers.AddRange(tmpLaunchers);

            SettingsChanged = false;
        }
Exemple #4
0
        /// <summary>
        /// Register all API modules that implement IApiModule
        /// </summary>
        private void RegisterModules()
        {
            var interfaceType = typeof(IModule);

            Modules = AppDomain.CurrentDomain.GetAssemblies()
                      .SelectMany(x => x.GetTypes())
                      .Where(x => interfaceType.IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract)
                      .Select(x => (IModule)Activator.CreateInstance(x, new object[] { this }))
                      .ToList();
            // Ordering modules before letting them register for item CRUD
            // events works in practice, but is not guarenteed. This should
            // be refactored.
            Modules.OrderBy(x => x.GetOrder()).ToList().ForEach((module) =>
            {
                Logger.LogDebug($"Module {module.GetType().Name}: loaded");
                module.GetManagers().ForEach(manager =>
                {
                    Logger.LogDebug($"Module {module.GetType().Name}: loading model manager {manager.GetType().Name}");
                    Managers.Add(manager);
                });
                Repositories.AddRange(module.GetRepositories());
                module.RegisterForMessages().ForEach(messageId =>
                {
                    if (MessageHandlers.ContainsKey(messageId))
                    {
                        MessageHandlers[messageId].Add(module);
                    }
                    else
                    {
                        MessageHandlers.Add(messageId, new List <IModule>()
                        {
                            module
                        });
                    }
                });
            });
            Modules.ForEach((module) =>
            {
                module.Initialize(Repositories);
                Logger.LogInformation($"Module {module.GetType().Name} initialized");
            });
            ModuleManagerReadyEvent?.Invoke();
        }
 public RepositoryHistorySurrogate(IEnumerable <Repository> repositories)
 {
     Repositories.AddRange(repositories);
 }
Exemple #6
0
        protected override async void OnInitialize()
        {
            var results = await repositories.Search("mvvm");

            Repositories.AddRange(results.Select(r => new RepositoryViewModel(r)));
        }