Alexandria.CheckIn.CheckIn_Click C# (CSharp) Méthode

CheckIn_Click() private méthode

private CheckIn_Click ( object sender, RoutedEventArgs e ) : void
sender object
e Windows.UI.Xaml.RoutedEventArgs
Résultat void
        private async void CheckIn_Click(object sender, RoutedEventArgs e)
        {
            Notice.Foreground = new SolidColorBrush(Windows.UI.Colors.Black);
            Notice.Text = "Attempting check in...";
            Dictionary<string, string> checkin = new Dictionary<string, string>();
            checkin["isbn"] = ISBN.Text;
            checkin["patron_barcode"] = Patron.Password;
            checkin["distributor_barcode"] = Distributor.Password;
            string json = JsonConvert.SerializeObject(checkin);
            try
            {
                HttpClient client = new HttpClient();
                StringContent theContent = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
                HttpResponseMessage aResponse = await client.PostAsync(new Uri("http://alexandria.ad.sofse.org/check_in.json"), theContent);
                string content = await aResponse.Content.ReadAsStringAsync();
                ISBN.Text = "";
                Patron.Password = "";
                Distributor.Password = "";
                if ((int)aResponse.StatusCode == 200)
                {
                    Dictionary<string, Dictionary<string,string>> dictionary = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string,string>>>(content);
                    this.Frame.Navigate(typeof(PutAway), dictionary);
                }
                else
                {
                    Dictionary<string, List<string>> dictionary = JsonConvert.DeserializeObject<Dictionary<string, List<string>>>(content);
                    string notice = "";
                    foreach (var item in dictionary)
                    {
                        foreach (var error in item.Value)
                        {
                            notice += error + "\n";
                        }
                    }
                    Notice.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                    Notice.Text = notice;
                }
            }
            catch (HttpRequestException)
            {
                Notice.Foreground = new SolidColorBrush(Windows.UI.Colors.Red);
                Notice.Text = "You might want to consider connecting to the internet...";
                return;
            }
        }
    }