public void GetTelephoneOperator(Image img, string errorMessage) { System.Windows.Media.Imaging.BitmapImage bitmapImg = new System.Windows.Media.Imaging.BitmapImage(); bitmapImg.CreateOptions = System.Windows.Media.Imaging.BitmapCreateOptions.BackgroundCreation; Dictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("command", "getMobilePhoneProviderCode"); parameters.Add("session_key", GlobalVariables.sessionId); parameters.Add("phone", text); var proxy = new WindowsPhonePostClient.PostClient(parameters); proxy.DownloadStringCompleted += (sender, e) => { if (e.Error == null) { JsonParse deserializedProduct = Newtonsoft.Json.JsonConvert.DeserializeObject<JsonParse>(e.Result); if (deserializedProduct.result == "success") { bitmapImg.UriSource = new Uri("https://www.myth.kz/VAADIN/themes/mytheme/images/" + deserializedProduct.data.providerCode + ".png", UriKind.Absolute); } else { bitmapImg.UriSource = new Uri("/img/registration/False.png", UriKind.Relative); MessageBox.Show(errorMessage); } } img.Source = bitmapImg; }; proxy.DownloadStringAsync(new Uri("http://192.168.1.71:8080/MobileApplication/mythapi", UriKind.Absolute)); }
private void ServerCheck(Image img) { System.Collections.Generic.Dictionary<string, object> parameters = new System.Collections.Generic.Dictionary<string, object>(); parameters.Add("command", "check" + type + "exist"); parameters.Add(type, text); WindowsPhonePostClient.PostClient proxy = new WindowsPhonePostClient.PostClient(parameters); proxy.DownloadStringCompleted += (sender, e) => { if (e.Error == null) { JsonParse deserializedProduct = Newtonsoft.Json.JsonConvert.DeserializeObject<JsonParse>(e.Result); if (deserializedProduct.result == "success") { if (deserializedProduct.exists == "true") { resultServer = false; MessageBox.Show(errorMessageServer); } else { resultServer = true; } } else MessageBox.Show(deserializedProduct.message); img.Source = new System.Windows.Media.Imaging.BitmapImage(new Uri("/img/registration/" + resultServer.ToString() + ".png", UriKind.Relative)); } }; proxy.DownloadStringAsync(new Uri("http://192.168.1.71:8080/MobileApplication/mythapi", UriKind.Absolute)); }