public static Shortlist Open(string id) { var key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\HomeHunter\Shortlists\" + id); if (key == null) { throw new InvalidOperationException("Shortlist " + id + " does not exist."); } var shortlist = new Shortlist(); shortlist.Id = id; shortlist.Name = key.GetValue("Name").ToString(); shortlist.ExcludeTerms = WebInput.ToList(key.GetValue("ExcludeTerms")); shortlist.IncludeTerms = WebInput.ToList(key.GetValue("IncludeTerms")); shortlist.ExcludePostcodes = WebInput.ToList(key.GetValue("ExcludePostcodes")); shortlist.MinimumPrice = Convert.ToInt32(key.GetValue("MinimumPrice")); shortlist.MaximumPrice = Convert.ToInt32(key.GetValue("MaximumPrice")); shortlist.AdvertisedOnOrAfter = (DateTimeRange)Convert.ToInt32(key.GetValue("AdvertisedOnOrAfter")); shortlist.AdvertisedForOrOver = (DateTimeRange)Convert.ToInt32(key.GetValue("AdvertisedForOrOver")); shortlist.SortOrder = (PropertyListingSortOrder)Convert.ToInt32(key.GetValue("SortOrder")); shortlist.LocationToSortBy = key.GetValue("LocationToSortBy").ToString(); shortlist.ExcludePriceOnApplication = Convert.ToBoolean(key.GetValue("ExcludePriceOnApplication")); shortlist.ExcludeOffersInvited = Convert.ToBoolean(key.GetValue("ExcludeOffersInvited")); shortlist.ResetIndexAtStart = Convert.ToBoolean(key.GetValue("ResetIndexAtStart")); shortlist.Rightmove42PageLimitFixEnabled = Convert.ToBoolean(key.GetValue("Rightmove42PageLimitFixEnabled")); shortlist.ExcludePropertyUrls = WebInput.ToList(key.GetValue("ExcludePropertyUrls")); return(shortlist); }
public static ShortlistEditor Open(string id, bool show = true) { var form = new ShortlistEditor(); form._shortlist = Shortlist.Open(id); if (show) { form.Show(); } return(form); }
private void DropDownItem_Click(object sender, EventArgs e) { var toolStripMenuItem = (ToolStripMenuItem)sender; try { Crawl(Shortlist.Open(toolStripMenuItem.Name)); } catch (UnexpectedPageFormatException) { MessageBox.Show("Unable to create a shortlist for this page."); } }
private void Crawl(Shortlist shortlist) { if (!IsCrawlable()) { if (_crawling) { File.WriteAllText(Path.Combine(OptionsForm.DataDirectory, "not-crawlable-response-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".html"), _browser.Address + Environment.NewLine + _currentHtml); _crawling = false; } throw new UnexpectedPageFormatException(); } if (!_crawling) { _crawling = true; _shortlist = shortlist; _shortlistedProperties.Clear(); _removedProperties.Clear(); _urlLog.Clear(); var newUrl = InitialisePagination(); newUrl = InitialisePriceRangeFilter(newUrl); newUrl = InitialiseBedroomsFilter(newUrl); if (!string.IsNullOrEmpty(newUrl)) { LoadUrl(newUrl); return; } //TODO: We should update the URL to take into account the price range in the filter. //TODO: We should update the URL to take into account the bedrooms in the filter. } ContinueCrawl(); }