1

次のエラーが発生したとき、プログラムを再テストしていました。何度かグーグルで調べてみましたが、説明が提供されていません。これが何を意味するのか、簡単に説明できる人はいますか?

前もって感謝します!

以下は私のコードです:

private void LoadBigFive(object o)
{
    string baseUrl = "https://api.whit.li/user/importToken?api_key={0}";
    string apiKey = "zuc9ka99w968qqssb2pbnk8a";

    string finalUrl = String.Format(baseUrl, apiKey);

   using (var wb = new WebClient())
    {
        var data = new NameValueCollection();
        data["uid"] = currentId;
        data["oauth_token"] = session;
        data["format"] = "json";

        var response = wb.UploadValues(finalUrl, "POST", data);
        string res = Encoding.UTF8.GetString(response, 0, response.Length);
        //MessageBox.Show(res);
    }

    string url = "https://api.whit.li/key/get?uid={0}&key_id=1&schema=fb&format=json&api_key={1}";
    string asdf = string.Format(url, currentId, apiKey);
    var req = WebRequest.Create(asdf);
    var qwe = req.GetResponse();
    string json = new StreamReader(qwe.GetResponseStream()).ReadToEnd();
    dynamic ghj = JsonConvert.DeserializeObject(json);
    rtyuio = new Dictionary<string, double>();
    ertyui = new Dictionary<string, string>();
    string qere = ghj["body"]["key"].ToString();
    string v2 = qere.Split(';')[1];
    rtyuio["Extraversion"] = Convert.ToDouble(v2.Split(',')[0].Split('(')[1]);
    rtyuio["Agreeableness"] = Convert.ToDouble(v2.Split(',')[1]);
    rtyuio["Stability"] = Convert.ToDouble(v2.Split(',')[2]);
    rtyuio["Conscientiousness"] = Convert.ToDouble(v2.Split(',')[3]);
    rtyuio["Openness to experience"] = Convert.ToDouble(v2.Split(',')[4].Split(')')    [0]);
    List<int> scores = new List<int>();
    foreach (var item in rtyuio)
    {
        if (item.Value >= 0 && item.Value <= 8)
            ertyui[item.Key] = "Low";
        else if (item.Value >= 9 && item.Value <= 17)
            ertyui[item.Key] = "Moderate";
        else if (item.Value >= 18 && item.Value <= 25)
            ertyui[item.Key] = "High";
    }

    var traitsList = from item in rtyuio
                     from qwee in ertyui
                     where item.Key == qwee.Key
                     select new ListViewItem(new[] 
                { item.Key, item.Value.ToString(), qwee.Value });
    Invoke((MethodInvoker)delegate
    {
        chart1.Series["Big5"].Points.DataBindXY(rtyuio.Keys, rtyuio.Values);
        listViewPersonalityTraits.Items.AddRange(traitsList.ToArray());
        string ext = string.Empty;
        string a = string.Empty;
        string s = string.Empty;
        string c = string.Empty;
        string op = string.Empty;
        foreach (var item in ertyui)
        {
            if (item.Value == "Low" && item.Key == "Extraversion")
                ext = "More reserved and prefer having more personal time. \r\n";
            else if (item.Value == "Moderate" && item.Key == "Extraversion")
                ext = "Balanced personality, can be both reserved and outgoing on different occasions. \r\n";
            else if (item.Value == "High" && item.Key == "Extraversion")
                ext = "Very outgoing and get energy from other people. \r\n";

            if (item.Value == "Low" && item.Key == "Agreeableness")
                a = "Tend to be more business like and opinionated. \r\n";
            else if (item.Value == "Moderate" && item.Key == "Agreeableness")
                a = "Mixture of personality, can be flexible but may be opinionated at times. \r\n";
            else if (item.Value == "High" && item.Key == "Agreeableness")
                a = "More flexible and cooperative. \r\n";

            if (item.Value == "Low" && item.Key == "Stability")
                s = "Individual tend to be more emotional in stressful situations. May not be able to cope and manage well. \r\n";
            else if (item.Value == "Moderate" && item.Key == "Stability")
                s = "Still acceptable, can handle adequate amount of stress appriroately. \r\n";
            else if (item.Value == "High" && item.Key == "Stability")
                s = "Individual is more stead and unflappable, even in situations that are stressful. \r\n";

            if (item.Value == "Low" && item.Key == "Conscientiousness")
                c = "May be more carefree and spontaneous. Probably much poorer in prioritising stuffs and events. \r\n";
            else if (item.Value == "Moderate" && item.Key == "Conscientiousness")
                c = "Balance between work and play. Will do work and will set time aside for relaxation. \r\n";
            else if (item.Value == "High" && item.Key == "Conscientiousness")
                c = "Act extremely dutifully and precisely. Very accurate and sharp, good priroitise.\r\n";

            if (item.Value == "Low" && item.Key == "Openness to experience")
                op = "Prefer consistent experience and traditional approach. May be reluctant and rigid to changes in methods or stuffs. \r\n";
            else if (item.Value == "Moderate" && item.Key == "Openness to experience")
                op = "Can adapt fairly well to changes although may prefer the old and usual methods of doing stuffs. \r\n";
            else if (item.Value == "High" && item.Key == "Openness to experience")
                op = "Very curious and like to experience new stuffs. Much more hands on, very inquisitive and high thirst for knowledge. Adaptable to new changes. \r\n";
        }
        textBox1.Text = "Based on the intensity of his traits, he would most likely have the following personality: " + "\n" + "Extraversion: " + ext + "\nAgreeableness: " + a + "\nStability: " + s + "\nConscientiousness: " + c + "\nOpenness to experience: " + op; 
        label9.Visible = false;
        pictureBox8.Visible = false;
    });
}
4

0 に答える 0