Esempio n. 1
0
        private static void Load()
        {
            SavedSearches.Clear();

            var n = 0;

            while (n < 99)
            {
                var siteName = AppHost.Settings.Get(StorageKey, "site" + n, null) as string;
                if (string.IsNullOrEmpty(siteName))
                {
                    break;
                }

                var name      = AppHost.Settings.Get(StorageKey, "name" + n, string.Empty) as string ?? string.Empty;
                var queryText = AppHost.Settings.Get(StorageKey, "querytext" + n, string.Empty) as string ?? string.Empty;
                var field     = AppHost.Settings.Get(StorageKey, "field" + n, string.Empty) as string ?? string.Empty;

                n++;

                var site = SiteManager.GetSite(siteName);
                if (site == null)
                {
                    continue;
                }

                var search = new SavedSearch
                {
                    Site      = site,
                    Name      = name,
                    QueryText = queryText,
                    Field     = field
                };

                SavedSearches.Add(search);
            }
        }
Esempio n. 2
0
        public static void Delete([NotNull] SavedSearch savedSearch)
        {
            Assert.ArgumentNotNull(savedSearch, nameof(savedSearch));

            SavedSearches.Remove(savedSearch);
        }
Esempio n. 3
0
        public static void Add([NotNull] SavedSearch savedSearch)
        {
            Assert.ArgumentNotNull(savedSearch, nameof(savedSearch));

            SavedSearches.Add(savedSearch);
        }