JumpKick.HttpLib.Samples/Form1.cs

(完整代码) 1KB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace JumpKick.HttpLib.Samples
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            new Form2().Show();
        }

        private void UpdateText(String text)
        {
            this.Invoke((MethodInvoker)delegate
            {
                txtResult.Text = text;
            });
        }

     

        private void btnView_Click(object sender, EventArgs e)
        {
            Http.Get(textBox1.Text).Headers(new { test = "hi", test2 ="y"}).OnSuccess((string a) =>
            {
                UpdateText(a);
            }).Go();
        }

        private void btnDownload_Click(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Http.Get(textBox1.Text).DownloadTo(dlg.FileName, onProgressChanged: (bytesCopied, totalBytes) =>
                    {
                        UpdateText(bytesCopied.ToString());
                    },
                    onSuccess: (headers) =>
                {
                    UpdateText("Download Complete");
                }).Go();
            }
        
        }

    }
}

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。