private void Button21_Click(object sender, RoutedEventArgs e) { calculate = Http.UrlEncode(textBox1.Text); string json = new HttpReq().GetJson("calc", calculate); JObject data = JObject.Parse(json); string result = (string)data["result"]; textBox1.Text = result; label1.Text = ""; }
private void StartClick(object sender, RoutedEventArgs e) { HttpRequest req = new HttpRequest(); HttpResponse resp; req.Cookies = new CookieDictionary(); var urlParams = new RequestParams(); urlParams["timeZone"] = comboArea.SelectedItem; resp = req.Get("http://localhost/ProjectG", urlParams); string json = resp.ToString(); JObject data; /* * H = DateTime.Now.Hour; * M = DateTime.Now.Minute; * S = DateTime.Now.Second; */ //need to edit //*end of need to edit if ((string)comboArea.SelectedItem != "" && comboArea.SelectedItem != null) { if (prevItem != comboArea.SelectedItem) { json = new HttpReq().GetJson("timeZone", comboArea.SelectedItem.ToString()); data = JObject.Parse(json); H = (int)data["hours"]; M = (int)data["minutes"]; S = (int)data["seconds"]; prevItem = comboArea.SelectedItem; display_txt.Text = "The country " + comboArea.SelectedItem; } } else { //get current time H = DateTime.Now.Hour; M = DateTime.Now.Minute; S = DateTime.Now.Second; } //end elad edit }