Пример #1
0
        private async void jokeButton_Click(object sender, EventArgs e)
        {
            Joke getJoke = await ChuckNorrisClient.GetRandomJoke();

            var randomJoke = getJoke.JokeText;

            MessageBox.Show(randomJoke);
        }
Пример #2
0
        private async void btnJoke_Click(object sender, EventArgs e)
        {
            Joke response = await ChuckNorrisClient.GetRandomJoke();

            String joke = response.JokeText;

            txtJoke.Text = joke;
        }
Пример #3
0
        private async void btnGetJoke_ClickAsync(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            string j = $"{joke.Id}:{joke.JokeText}\n\n{string.Join(",", joke.Categories)}";

            MessageBox.Show(j);
        }
Пример #4
0
        private async void jokeBtn_ClickAsync(object sender, EventArgs e)
        {
            if (categoriesCbx.SelectedIndex >= 0)
            {
                string category = categoriesCbx.SelectedItem.ToString();
            }
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            jokeLbl.Text = joke.JokeText;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            string includeTypes = comboBox1.SelectedItem as string;
            var    selectedJoke = ChuckNorrisClient.GetRandomJoke();

            while (selectedJoke != includeTypes)
            {
                selectedJoke = ChuckNorrisClient.GetRandomJoke();
            }
            textBox1.Text = WebUtility.HtmlDecode(selectedJoke);
        }
Пример #6
0
        private async void SearchAPIForJoke()
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            DialogResult result = MessageBox.Show(joke.JokeText, "Chuck Norris API Joke", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

            if (result.Equals(MessageBoxButtons.OK))
            {
                return;
            }
        }
Пример #7
0
        private static async Task Run()
        {
            //get random joke test
            WriteLine("Getting a single joke**********************");
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            WriteLine($"{j.Id}:{j.JokeText}\n\n{string.Join(", ", j.Categories)}");

            //get categories
            WriteLine("Getting categories****************************");
            IEnumerable <string> categories = await ChuckNorrisClient.GetCategories();

            foreach (var cat in categories)
            {
                WriteLine(cat);
            }

            //print specific joke
            WriteLine("Getting specific joke***************************");
            Joke j2 = await ChuckNorrisClient.GetJokeById(2);

            WriteLine(j2.JokeText);

            //retrieve joke that doesn't exist
            WriteLine("Retrieving non-existent joke********************");
            try
            {
                Joke j3 = await ChuckNorrisClient.GetJokeById(20000000);
            }
            catch (NoSuchQuoteException)
            {
                WriteLine("There is no joke/quote with that id");
            }


            ReadKey();
        }
Пример #8
0
        private async void GetJokeBtn_ClickAsync(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            /*
             * string sel = categoriesComboBox.SelectedItem.ToString();
             * //MessageBox.Show(sel, "test");
             * string cat = j.Categories.ToString();
             *
             * if ( !(cat == sel) ) {
             *
             *  while (!(cat == sel))
             *  {
             *      j = await ChuckNorrisClient.GetRandomJoke();
             *      cat = j.Categories.ToString();
             *  }
             *
             * }
             */

            String text = j.Id + " : " + j.JokeText;

            MessageBox.Show(text, "Joke Display");
        }
        private async void BtnDispense_Click(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            lblFact.Text = j.JokeText;
        }
Пример #10
0
        private async void BtnGetJoke_ClickAsync(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show(j.JokeText);
        }
Пример #11
0
        private async void BtnRandJoke_ClickAsync(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            TxtJoke.Text = joke.JokeText;
        }
Пример #12
0
        private async void BtnGetJoke_Click(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show($"{j.Id}:{j.JokeText}\n\n{string.Join(", ", j.Categories)}");
        }
Пример #13
0
        private async void btnGetJoke_ClickAsync(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            txtJokeDisplay.Text = joke.JokeText;
        }
Пример #14
0
        private async void button1_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            jokeBox.Text = joke.JokeText;
        }
Пример #15
0
        private async void button1_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show(joke.JokeText, "Chuck Norris Joke");
        }
Пример #16
0
        private async void btnGetJoke_Click(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            txtJoke.Text = j.JokeText;
        }
Пример #17
0
 private async static Task <Joke> GetJoke()
 {
     return(await ChuckNorrisClient.GetRandomJoke());
 }
Пример #18
0
        private async void button1_Click(object sender, EventArgs e)
        {
            var c = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show(c.JokeText);
        }
Пример #19
0
        private async void randomJokeBtn_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            randomJokeRtx.Text = joke.JokeText;
        }
Пример #20
0
        private async void BtnGetJoke_Click(object sender, EventArgs e)
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show($"{j.JokeText.ToString()}");
        }
Пример #21
0
        private async void btn_JokeGenerator_Click(object sender, EventArgs e)
        {
            Joke res = await ChuckNorrisClient.GetRandomJoke();

            txt_JokeResult.Text = res.JokeText;
        }
Пример #22
0
        /// <summary>
        /// Get one joke per button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void GetJoke_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            JokeLbl.Text = joke.JokeText;
        }
Пример #23
0
 private async void button1_Click(object sender, EventArgs e)
 {
     label2.Text = (await ChuckNorrisClient.GetRandomJoke()).JokeText;
 }
Пример #24
0
        private async void btnGenerateJoke_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            DisplayJoke.Text = joke.JokeText;
        }
Пример #25
0
        private async void getJokeBtn_Click(object sender, EventArgs e)
        {
            Joke joke = await ChuckNorrisClient.GetRandomJoke();

            MessageBox.Show(joke.JokeText);
        }
        private async void Get_Joke()
        {
            Joke j = await ChuckNorrisClient.GetRandomJoke();

            RtbJoke.Text = j.JokeText;
        }