private void InitialiseData() { GpPracticeDataResults = new GpPracticeDataResults(); GpPracticeDataResults.LoadData("gpservices.dat"); SchoolDataResults = new SchoolDataResults(); SchoolDataResults.LoadData("schools.dat"); DentistDataResults = new DentistDataResults(); DentistDataResults.LoadData("dentists.dat"); Service = Services.GP; WatermarkText = "Enter postcode"; ResultsGrid.AutoGenerateColumns = true; ResultsGrid.AutoGeneratingColumn += ResultsGrid_AutoGeneratingColumn; }
private void SearchServices() { try { patientCoordinate = Models.Utilities.GetPostcodeCoordinates(Postcode); var distance = Unit == Units.Mile ? Models.Utilities.MileToKm(Distance) : Distance; if (Service == Services.GP) { GpPracticeDataResults.FilterResults(patientCoordinate, distance, Unit); } else if (Service == Services.Schools) { SchoolDataResults.FilterResults(patientCoordinate, distance, IsNursery, Unit); } else if (Service == Services.Dentists) { DentistDataResults.FilterResults(patientCoordinate, distance, Unit); } OnPropertyChanged("FoundResults"); using (var htmlReader = new System.IO.StreamReader("index.html")) { string content = htmlReader.ReadToEnd(); webBrowser.Source = new System.Uri($"data:text/html, {content}"); webBrowser.DocumentReady += WebBrowser_DocumentReady; webBrowser.ConsoleMessage += WebBrowser_ConsoleMessage; webBrowser.Reload(true); } } catch (InvalidPostcodeException ex) { MessageBox.Show(ex.Message); } }