Exemplo n.º 1
0
 private void Form1_Load(object sender, EventArgs e)
 {
     WeatherDataInformation weatherData = new WeatherDataInformation();
     WeatherDataRetriever weatherDataRetriever = new WeatherDataRetriever();
     DataCleaner dataCleaner = new DataCleaner();
     string html = weatherDataRetriever.GetHTML("http://raider.mountunion.edu/~weather/Bracy_Vantage_Pro_Plus.htm");
     string cleanData = dataCleaner.RemoveHTML(html);
     //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\html.txt", html);
     //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\clean.txt", cleanData);
     MAKEITPRETTY pretty = new MAKEITPRETTY(cleanData, weatherData);
     weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\data.txt", weatherData.ToString());
     this.Close();
 }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WeatherDataInformation weatherData          = new WeatherDataInformation();
            WeatherDataRetriever   weatherDataRetriever = new WeatherDataRetriever();
            DataCleaner            dataCleaner          = new DataCleaner();
            string html      = weatherDataRetriever.GetHTML("http://raider.mountunion.edu/~weather/Bracy_Vantage_Pro_Plus.htm");
            string cleanData = dataCleaner.RemoveHTML(html);
            //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\html.txt", html);
            //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\clean.txt", cleanData);
            MAKEITPRETTY pretty = new MAKEITPRETTY(cleanData, weatherData);

            weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\data.txt", weatherData.ToString());
            this.Close();
        }
Exemplo n.º 3
0
        public MAKEITPRETTY(string currentWeatherAtBracy, WeatherDataInformation weatherData)
        {
            array = currentWeatherAtBracy.Split('\n');

            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].Equals("Temperature"))
                {
                    weatherData.CurrentTemperature = array[i + 1];
                }
                if (array[i].Equals("Humidity"))
                {
                    weatherData.Humidity = array[i + 1];
                }
                if (array[i].Equals("Wind"))
                {
                    weatherData.Wind = array[i + 1];
                }
                if (array[i].Equals("Barometer"))
                {
                    weatherData.Barometer = array[i + 1];
                }
                if (array[i].Equals("Today's Rain"))
                {
                    weatherData.TodaysRain = array[i + 1];
                }
                if (array[i].Equals("Wind Chill"))
                {
                    weatherData.WindChill = array[i + 1];
                }
                if (array[i].Equals("High TemperatureLow Temperature"))
                {
                    weatherData.HighTemperature = array[i + 1] + " " + array[i + 2] + " " + array[i + 3].Substring(0, 6);
                    if (array[i + 3].Contains("Fat"))
                    {
                        array[i + 3] = Regex.Replace(array[i + 3], "Fat", "F at");
                    }
                    weatherData.LowTemperature = array[i + 3].Substring(6) + " " + array[i + 4];
                }
            }

            //Console.Out.WriteLine(weatherData.ToString());

        }
Exemplo n.º 4
0
        public MAKEITPRETTY(string currentWeatherAtBracy, WeatherDataInformation weatherData)
        {
            array = currentWeatherAtBracy.Split('\n');

            for (int i = 0; i < array.Length; i++)
            {
                if (array[i].Equals("Temperature"))
                {
                    weatherData.CurrentTemperature = array[i + 1];
                }
                if (array[i].Equals("Humidity"))
                {
                    weatherData.Humidity = array[i + 1];
                }
                if (array[i].Equals("Wind"))
                {
                    weatherData.Wind = array[i + 1];
                }
                if (array[i].Equals("Barometer"))
                {
                    weatherData.Barometer = array[i + 1];
                }
                if (array[i].Equals("Today's Rain"))
                {
                    weatherData.TodaysRain = array[i + 1];
                }
                if (array[i].Equals("Wind Chill"))
                {
                    weatherData.WindChill = array[i + 1];
                }
                if (array[i].Equals("High TemperatureLow Temperature"))
                {
                    weatherData.HighTemperature = array[i + 1] + " " + array[i + 2] + " " + array[i + 3].Substring(0, 6);
                    if (array[i + 3].Contains("Fat"))
                    {
                        array[i + 3] = Regex.Replace(array[i + 3], "Fat", "F at");
                    }
                    weatherData.LowTemperature = array[i + 3].Substring(6) + " " + array[i + 4];
                }
            }

            //Console.Out.WriteLine(weatherData.ToString());
        }
Exemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        WeatherDataInformation weatherData = new WeatherDataInformation();
        WeatherDataRetriever weatherDataRetriever = new WeatherDataRetriever();
        DataCleaner dataCleaner = new DataCleaner();
        string html = weatherDataRetriever.GetHTML("http://raider.mountunion.edu/~weather/Bracy_Vantage_Pro_Plus.htm");
        string cleanData = dataCleaner.RemoveHTML(html);
        //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\html.txt", html);
        //weatherDataRetriever.WriteToFile(@"C:\Users\TIMMAH\Desktop\clean.txt", cleanData);
        MAKEITPRETTY pretty = new MAKEITPRETTY(cleanData, weatherData);

        lblCurrentTemperature.Text = "Current Temperature: " + weatherData.CurrentTemperature;
        lblHumidity.Text = "Humidity: " + weatherData.Humidity;
        lblWind.Text = "Wind: " + weatherData.Wind;
        lblBarometer.Text = "Barometer: " + weatherData.Barometer;
        lblTodaysRain.Text = "Today's Rain: " + weatherData.TodaysRain;
        lblWindChill.Text = "Wind Chill: " + weatherData.WindChill;
        lblHighTemperature.Text = "Today's High Temperature: " + weatherData.HighTemperature;
        lblLowTemperature.Text = "Today's Low Temperature: " + weatherData.LowTemperature;

        //MyIFrame.Attributes["src"] = "http://openweathermap.org/help/tiles.html?opacity=0.8&l=precipitation";
        MyIFrame.Attributes["src"] = "https://weather.com/weather/radar/interactive/l/USOH0013:1:US?layer=radarConus&zoom=7";
        //MyIFrame.Attributes["src"] = "http://www.accuweather.com/en/us/alliance-oh/44601/weather-radar/335070";
    }