Beispiel #1
0
        static void Main(string[] args)
        {
            var r = ReqParse.GetReq().Result;

            Console.WriteLine(r.value[0].joke.ToString());


            Console.ReadLine();
        }
        private async void button2_Click(object sender, EventArgs e)
        {
            var result1 = await ReqParse.GetReq();

            var all = new List <string>();

            foreach (var i in result1.value)
            {
                all.Add(i.joke.ToString());
            }
            richTextBox1.Text = String.Join("\n\n", all);
        }
        private async void button1_Click(object sender, EventArgs e)
        {
            var result = await ReqParse.GetReq();

            var lst = new List <string>();

            //foreach(var i in lst)
            //richTextBox1.Text = result.value[0].joke.ToString();
            if (comboBox1.SelectedIndex == 0)
            {
                foreach (var i in result.value)
                {
                    foreach (var j in i.categories)
                    {
                        if (j == "nerdy")
                        {
                            lst.Add(i.joke.ToString());
                        }
                    }
                }
                richTextBox1.Text = String.Join("\n\n", lst);
            }

            else if (comboBox1.SelectedIndex == 1)
            {
                foreach (var i in result.value)
                {
                    foreach (var j in i.categories)
                    {
                        if (j == "explicit")
                        {
                            lst.Add(i.joke.ToString());
                        }
                    }
                }
                richTextBox1.Text = String.Join("\n\n", lst);
            }
            //else if (comboBox1.SelectedIndex == 2)
            //{

            //}
            else
            {
                richTextBox1.Text = "Choose a category!";
            }
        }