Пример #1
0
        private void WriteConsoleLine(string Text, string Prefix = "")
        {
            string TimeStamp = DateTime.Now.ToString("HH:mm:ss");

            if (Prefix.Length == 0)
            {
                ConsoleRichBox.Text += '[' + TimeStamp + "] - " + Text + '\n';
            }
            else
            {
                ConsoleRichBox.Text += '[' + Prefix + "] - " + Text + '\n';
            }

            ConsoleRichBox.Focus();
            ConsoleRichBox.Select(ConsoleRichBox.Text.Length, 0);
        }
Пример #2
0
        private async void DownloadButton_Click(object sender, EventArgs e)
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.Add("X-FullContact-APIKey", "97a086b3aac1b0a5");
            var response = await client.GetAsync(
                "https://api.fullcontact.com/v2/company/lookup.json?domain=fullcontact.com");

            var responseContent = response.Content;

            using (var reader = new StreamReader(await responseContent.ReadAsStreamAsync()))
            {
                var company = JsonConvert.DeserializeObject <Company>(await reader.ReadToEndAsync());
                ConsoleRichBox.AppendText(company.languageLocale + Environment.NewLine);
            }
        }