private void WeeklyWeather()
        {
            ////////////////////////
            //tomorrowforcast.Text = "weather forcast for tomorrow :" + GetWeather("description");
            HtmlToText convert = new HtmlToText();

            tomorrowforcast.Text = convert.Convert(GetWeather("description"));
            string textreplace = tomorrowforcast.Text;
            string text        = String.Format(tomorrowforcast.Text);

            text = text.Replace("Sat", "Saturday");
            text = text.Replace("Low", " Low");
            Marvel.SpeakAsync("now weather forcast for whole week, " + text.ToString());
            ////////////////////////////////////////////
        }
Esempio n. 2
0
        private void WakeUpAlarm_Load(object sender, EventArgs e)
        {
            //int h = Screen.PrimaryScreen.WorkingArea.Height;
            //int w = Screen.PrimaryScreen.WorkingArea.Width;
            //this.ClientSize = new Size(w, h);

            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            TopMost         = true;
            labelnet.Text   = NetworkInterface.GetIsNetworkAvailable().ToString();

            if (labelnet.Text == "True")
            {
                weatherbg.Navigate("https://www.msn.com/en-us/weather");
                dayofweeklbl.Text    = System.DateTime.Now.ToString("dddd", new System.Globalization.CultureInfo("en-US"));
                compeletdatelbl.Text = System.DateTime.Now.ToString("dd MMM yyyy", new System.Globalization.CultureInfo("en-US"));
                templbl.Text         = GetWeather("temp");
                conditionlbl.Text    = GetWeather("cond");
                highlbl.Text         = GetWeather("high");
                lowlbl.Text          = GetWeather("low");
                humiditylbl.Text     = GetWeather("humidity");
                windspeedlbl.Text    = GetWeather("chill") + " miles per hour";
                sunriselbl.Text      = GetWeather("sunrise");
                sunsetlbl.Text       = GetWeather("sunset");


                if (conditionlbl.Text == "Tornado")
                {
                    Image image = Properties.Resources.tornado;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Tropical Storm")
                {
                    Image image = Properties.Resources.thunderstorms;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Hurricane")
                {
                    Image image = Properties.Resources.thunderstorms;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Severe Thunderstorms")
                {
                    Image image = Properties.Resources.severe_thunderstorms;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Thunderstorms")
                {
                    Image image = Properties.Resources.thunderstorms;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Mixed Rain And Snow")
                {
                    Image image = Properties.Resources.mixed_rain_and_snow;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Mixed Rain And Sleet")
                {
                    Image image = Properties.Resources.mixed_rain_and_sleet;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Freezing Drizzle")
                {
                    Image image = Properties.Resources.freezing_drizzle;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Drizzle")
                {
                    Image image = Properties.Resources.drizzle;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Freezing Rain")
                {
                    Image image = Properties.Resources.freezing_rain;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Showers")
                {
                    Image image = Properties.Resources.showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Snow Flurries")
                {
                    Image image = Properties.Resources.snow_flurries;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Light Snow Showers")
                {
                    Image image = Properties.Resources.light_snow_showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Blowing Snow")
                {
                    Image image = Properties.Resources.blowing_snow;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Snow")
                {
                    Image image = Properties.Resources.snow;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Hail")
                {
                    Image image = Properties.Resources.hail;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Sleet")
                {
                    Image image = Properties.Resources.sleet;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Dust")
                {
                    Image image = Properties.Resources.dust;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Foggy")
                {
                    Image image = Properties.Resources.foggy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Haze")
                {
                    Image image = Properties.Resources.haze;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Smoky")
                {
                    Image image = Properties.Resources.smoky;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Blustery")
                {
                    Image image = Properties.Resources.blustery;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Windy")
                {
                    Image image = Properties.Resources.windy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Cold")
                {
                    Image image = Properties.Resources.cold;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Cloudy")
                {
                    Image image = Properties.Resources.cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Mostly Cloudy Night")
                {
                    Image image = Properties.Resources.mostly_cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Mostly Cloudy")
                {
                    Image image = Properties.Resources.mostly_cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Partly Cloudy Night")
                {
                    Image image = Properties.Resources.mostly_cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Partly Cloudy")
                {
                    Image image = Properties.Resources.mostly_cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Clear")
                {
                    System.DateTime timenow = System.DateTime.Now;
                    if (timenow.Hour >= 5 && timenow.Hour < 12)
                    {
                        Image images = Properties.Resources.hot;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = images;
                        weatherimg.Height = images.Height;
                        weatherimg.Width  = images.Width;
                    }
                    if (timenow.Hour >= 12 && timenow.Hour < 18)
                    {
                        Image images = Properties.Resources.hot;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = images;
                        weatherimg.Height = images.Height;
                        weatherimg.Width  = images.Width;
                    }
                    if (timenow.Hour >= 18 && timenow.Hour < 24)
                    {
                        Image image = Properties.Resources.clear_night;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = image;
                        weatherimg.Height = image.Height;
                        weatherimg.Width  = image.Width;
                    }
                    if (timenow.Hour < 5)
                    {
                        Image image = Properties.Resources.clear_night;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = image;
                        weatherimg.Height = image.Height;
                        weatherimg.Width  = image.Width;
                    }
                }
                if (conditionlbl.Text == "Mostly Clear")
                {
                    System.DateTime timenow = System.DateTime.Now;
                    if (timenow.Hour >= 5 && timenow.Hour < 12)
                    {
                        Image images = Properties.Resources.hot;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = images;
                        weatherimg.Height = images.Height;
                        weatherimg.Width  = images.Width;
                    }
                    if (timenow.Hour >= 12 && timenow.Hour < 18)
                    {
                        Image images = Properties.Resources.hot;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = images;
                        weatherimg.Height = images.Height;
                        weatherimg.Width  = images.Width;
                    }
                    if (timenow.Hour >= 18 && timenow.Hour < 24)
                    {
                        Image image = Properties.Resources.clear_night;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = image;
                        weatherimg.Height = image.Height;
                        weatherimg.Width  = image.Width;
                    }
                    if (timenow.Hour < 5)
                    {
                        Image image = Properties.Resources.clear_night;
                        // Set the PictureBox image property to this image.
                        // ... Then, adjust its height and width properties.
                        weatherimg.Image  = image;
                        weatherimg.Height = image.Height;
                        weatherimg.Width  = image.Width;
                    }
                }
                if (conditionlbl.Text == "Sunny")
                {
                    Image image = Properties.Resources.sunny;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Fair Night")
                {
                    Image image = Properties.Resources.fair_night;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Fair")
                {
                    Image image = Properties.Resources.fair_day;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Mixed Rain And Hail")
                {
                    Image image = Properties.Resources.mixed_rain_and_hail;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Hot")
                {
                    Image image = Properties.Resources.hot;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Isolated Thunderstorms")
                {
                    Image image = Properties.Resources.isolated_thundershowers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Scattered Thunderstorms")
                {
                    Image image = Properties.Resources.scattered_snow_showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }

                if (conditionlbl.Text == "Scattered Showers")
                {
                    Image image = Properties.Resources.scattered_snow_showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Heavy Snow")
                {
                    Image image = Properties.Resources.heavy_snow;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Scattered Snow Showers")
                {
                    Image image = Properties.Resources.scattered_snow_showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Partly Cloudy")
                {
                    Image image = Properties.Resources.partly_cloudy;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Thundershowers")
                {
                    Image image = Properties.Resources.thunderstorms;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Snow Showers")
                {
                    Image image = Properties.Resources.snow_showers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
                if (conditionlbl.Text == "Isolated Thundershowers")
                {
                    Image image = Properties.Resources.isolated_thundershowers;
                    // Set the PictureBox image property to this image.
                    // ... Then, adjust its height and width properties.
                    weatherimg.Image  = image;
                    weatherimg.Height = image.Height;
                    weatherimg.Width  = image.Width;
                }
            }
            if (labelnet.Text == "False")
            {
            }
            ////////////////////////
            //tomorrowforcast.Text = "weather forcast for tomorrow :" + GetWeather("description");
            HtmlToText convert = new HtmlToText();

            tomorrowforcast.Text = convert.Convert(GetWeather("description"));
            string textreplace = tomorrowforcast.Text;
            string text        = String.Format(tomorrowforcast.Text);

            text = text.Replace("Sat", "Saturday");
            //computer.SpeakAsync("now weather forcast for whole week, " + text);
            ////////////////////////////////////////////
        }