Exemplo n.º 1
0
        private void SaveChanges()
        {
            string url = $"http://api.openweathermap.org/data/2.5/weather?q={City_textBox.Text}&appid={Properties.Settings.Default.Key}";

            if (Weather.IsAvaible(url))
            {
                Properties.Settings.Default.City = City_textBox.Text;
                Main.Start();
                Main.UpdateInfo();
                Properties.Settings.Default.ForeColor = TextColor_panel.BackColor;
                Properties.Settings.Default.MenuColor = MenuColor_panel.BackColor;
                if (FixedBackImage_radioButton.Checked)
                {
                    Properties.Settings.Default.FixedBackImage = true;
                }
                else
                {
                    Properties.Settings.Default.FixedBackImage = false;
                }
                Properties.Settings.Default.Save();
            }
            else
            {
                City_textBox.Text = Properties.Settings.Default.City;
            }
        }
Exemplo n.º 2
0
        // END

        private void Save_button_Click(object sender, EventArgs e)
        {
            string url = $"http://api.openweathermap.org/data/2.5/weather?q={City_textBox.Text}&appid={Properties.Settings.Default.Key}";

            if (Weather.IsAvaible(url))
            {
                Properties.Settings.Default.City = City_textBox.Text;
                Main.Start();
                Main.UpdateInfo();
                Properties.Settings.Default.ForeColor = GetColor();
                Properties.Settings.Default.Save();
                Main.UpdateForeColor();
                Hide();
            }
            else
            {
                City_textBox.Text = Properties.Settings.Default.City;
            }
        }