private void button1_Click(object sender, RoutedEventArgs e)    // 下载一下载
        {
            if (textBox_url_1.Text != "")
            {
                HttpWebRequest request = null;
                try
                {
                    request = (HttpWebRequest)HttpWebRequest.Create(textBox_url_1.Text);
                    request.GetResponse();//获得接收流
                    request.Abort();
                    chosepath ch   = new chosepath();
                    string    path = ch.SaveFilePath() + @"\";
                    m1.Start_load(3, textBox_url_1.Text, path);
                    labelname1.Content = m1.true_filename;
                    textBox_url_1.Text = "";
                }
                catch (Exception er)
                {
                    MessageBox.Show("建立连接失败");
                }
            }

            else
            {
                MessageBox.Show("建立连接失败");
            }
        }
Beispiel #2
0
        //下载2下载
        private void button5_Click_1(object sender, RoutedEventArgs e)
        {
            if (textBox_url2.Text != "")
            {
                HttpWebRequest request = null;
                try
                {
                    request = (HttpWebRequest)HttpWebRequest.Create(textBox_url2.Text);
                    request.GetResponse();//获得接收流
                    request.Abort();
                    chosepath ch = new chosepath();
                    string path = ch.SaveFilePath() + @"\";
                    m2.Start_load(3, textBox_url2.Text, path);
                    labelname1.Content = m2.true_filename;
                    textBox_url2.Text = "";
                }
                catch (Exception er)
                {
                    MessageBox.Show("建立连接失败");

                }
            }

            else
            {
                MessageBox.Show("建立连接失败");
            }
        }