public void Init(PluginInitContext context) { this.context = context; _settings = context.API.LoadSettingJsonStorage <Settings>(); cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings); }
public List <Result> Query(Query query) { string param = query.Search.TrimStart(); // Should top results be returned? (true if no search parameters have been passed) var topResults = string.IsNullOrEmpty(param); if (!topResults) { // Since we mixed chrome and firefox bookmarks, we should order them again var returnList = cachedBookmarks.Select(c => new Result() { Title = c.Name, SubTitle = c.Url, IcoPath = @"Images\bookmark.png", Score = BookmarkLoader.MatchProgram(c, param).Score, Action = _ => { context.API.OpenUrl(c.Url); return(true); }, ContextData = new BookmarkAttributes { Url = c.Url } }).Where(r => r.Score > 0); return(returnList.ToList()); } else { return(cachedBookmarks.Select(c => new Result() { Title = c.Name, SubTitle = c.Url, IcoPath = @"Images\bookmark.png", Score = 5, Action = _ => { context.API.OpenUrl(c.Url); return true; }, ContextData = new BookmarkAttributes { Url = c.Url } }).ToList()); } }
public async Task Load() { await Task.WhenAll(IssueLoader.Load(), DecisionsLoader.Load(), EventsLoader.Load(), InventionsLoader.Load(), TechnologiesLoader.Load(), PopLoader.Load(), UnitLoader.Load(), ProvinceLoader.Load(), PopTypeLoader.Load(), DiplomacyLoader.Load(), OobLoader.Load(), WarLoader.Load(), BookmarkLoader.Load(), BuildingLoader.Load(), CbLoader.Load(), CotColorLoader.Load(), NationalFocusLoader.Load(), GraphicalCultureLoader.Load(), IdeologyLoader.Load(), CountryLoader.Load(), CountryColorsLoader.Load(), CrimeLoader.Load(), CultureLoader.Load(), DefinesLoader.Load(), EventModifiersLoader.Load(), GoodsLoader.Load(), GovernmentsLoader.Load(), NationalValueLoader.Load(), OnActionsLoader.Load(), PopTypeLoader.Load(), ProductionTypeLoader.Load(), RebelTypeLoader.Load(), ReligionLoader.Load(), StaticModifiersLoader.Load(), TechSchoolLoader.Load(), TraitsLoader.Load(), TriggeredModifiersLoader.Load(), CountryDirectoryLoader.Load() ); }
public void ReloadData() { cachedBookmarks.Clear(); cachedBookmarks = BookmarkLoader.LoadAllBookmarks(_settings); }