示例#1
0
        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);
        }
示例#2
0
        protected override void OnBrowserFrameLoadEnd(object sender, FrameLoadEndEventArgs e)
        {
            SetInputValue("name", _shortlist.Name);

            SetInputValue("excludeTerms", WebInput.ToWebString(_shortlist.ExcludeTerms));
            SetInputValue("includeTerms", WebInput.ToWebString(_shortlist.IncludeTerms));

            SetInputValue("excludePostcodes", WebInput.ToWebString(_shortlist.ExcludePostcodes));

            if (_shortlist.MinimumPrice > -1)
            {
                SetInputValue("minimumPrice", _shortlist.MinimumPrice.ToString());
            }
            if (_shortlist.MaximumPrice > -1)
            {
                SetInputValue("maximumPrice", _shortlist.MaximumPrice.ToString());
            }

            SetInputValue("advertisedOnOrAfter", (int)_shortlist.AdvertisedOnOrAfter);
            SetInputValue("advertisedForOrOver", (int)_shortlist.AdvertisedForOrOver);

            SetInputValue("sortOrder", (int)_shortlist.SortOrder);
            SetInputValue("locationToSortBy", _shortlist.LocationToSortBy);

            SetInputValue("excludePriceOnApplication", _shortlist.ExcludePriceOnApplication);
            SetInputValue("excludeOffersInvited", _shortlist.ExcludeOffersInvited);

            SetInputValue("resetIndexAtStart", _shortlist.ResetIndexAtStart);
            SetInputValue("rightmove42PageLimitFixEnabled", _shortlist.Rightmove42PageLimitFixEnabled);

            //browser.ShowDevTools();
        }
示例#3
0
        public void Save()
        {
            RegistryKey key;

            if (string.IsNullOrEmpty(Id))
            {
                Id  = GenerateNewId();
                key = Registry.CurrentUser.CreateSubKey(@"SOFTWARE\HomeHunter\Shortlists\" + Id);
            }
            else
            {
                key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\HomeHunter\Shortlists\" + Id, true);
            }

            key.SetValue("Name", Name);
            key.SetValue("ExcludeTerms", WebInput.ToRegistryString(ExcludeTerms));
            key.SetValue("IncludeTerms", WebInput.ToRegistryString(IncludeTerms));
            key.SetValue("ExcludePostcodes", WebInput.ToRegistryString(ExcludePostcodes));
            key.SetValue("MinimumPrice", MinimumPrice.ToString()); // Stored as string due to the -1 value.
            key.SetValue("MaximumPrice", MaximumPrice.ToString()); // Stored as string due to the -1 value.
            key.SetValue("AdvertisedOnOrAfter", (int)AdvertisedOnOrAfter);
            key.SetValue("AdvertisedForOrOver", (int)AdvertisedForOrOver);
            key.SetValue("SortOrder", (int)SortOrder);
            key.SetValue("LocationToSortBy", LocationToSortBy);
            key.SetValue("ExcludePriceOnApplication", ExcludePriceOnApplication);
            key.SetValue("ExcludeOffersInvited", ExcludeOffersInvited);
            key.SetValue("ResetIndexAtStart", ResetIndexAtStart);
            key.SetValue("Rightmove42PageLimitFixEnabled", Rightmove42PageLimitFixEnabled);
            key.SetValue("ExcludePropertyUrls", ExcludePropertyUrls);
        }
示例#4
0
 public void Save(dynamic eventArgs)
 {
     _shortlist.Name                      = eventArgs.name;
     _shortlist.ExcludeTerms              = WebInput.ToList(eventArgs.excludeTerms);
     _shortlist.IncludeTerms              = WebInput.ToList(eventArgs.includeTerms);
     _shortlist.ExcludePostcodes          = WebInput.ToList(eventArgs.excludePostcodes);
     _shortlist.MinimumPrice              = WebInput.ToInt32(eventArgs.minimumPrice);
     _shortlist.MaximumPrice              = WebInput.ToInt32(eventArgs.maximumPrice);
     _shortlist.AdvertisedOnOrAfter       = (DateTimeRange)Convert.ToInt32(eventArgs.advertisedOnOrAfter);
     _shortlist.AdvertisedForOrOver       = (DateTimeRange)Convert.ToInt32(eventArgs.advertisedForOrOver);
     _shortlist.SortOrder                 = (PropertyListingSortOrder)Convert.ToInt32(eventArgs.sortOrder);
     _shortlist.LocationToSortBy          = eventArgs.locationToSortBy;
     _shortlist.ExcludePriceOnApplication = Convert.ToBoolean(eventArgs.excludePriceOnApplication);
     _shortlist.ExcludeOffersInvited      = Convert.ToBoolean(eventArgs.excludeOffersInvited);
     _shortlist.Save();
     this.InvokeOnUiThreadIfRequired(() => Close());
 }