Exemple #1
0
 /// <summary>
 /// generates API request using user given parameters
 /// </summary>
 public void CreateHTTPRequestURL()
 {
     if (City.Equals("") || Days.Equals(""))
     {
         MessageBox.Show("You must provide both values!", "ERROR!");
         ErrorOccured = true;
     }
     else if (!Regex.IsMatch(City, @"^[a-zA-Z]+$"))
     {
         MessageBox.Show("Use only latin letters in City field!", "ERROR!");
         ErrorOccured = true;
     }
     else
     {
         URL          = string.Format(@"http://api.openweathermap.org/data/2.5/forecast?q=" + City + "&mode=xml&appid=2517431d46cd54e4f965409583890e1c&cnt=" + Days + "&units=metric");
         ErrorOccured = false;
     }
 }