首页 > 编程知识 正文

c语言,c语言怎么学才能学好

时间:2023-05-03 16:19:42 阅读:116351 作者:994

用户系统; using system.collections.generic; using系统.component model; usingSystem.Data; usingSystem.Drawing; usingSystem.Linq; usingSystem.Net; usingSystem.Text; usingSystem.Windows.Forms; namespaceTestProxy

{ publicpartialclassmainform : form }

{公共主信息()

{

} privatevoidbtndownload _ click (对象发送器,事件发生器() ) ) ) ) ) ) ) )。

{try{

开始(;

} Catch (执行Ex ) ) ) ) )。

{

messagebox.show(ex.message;

}

}私有语音开始(

{

txtResult.Clear (; var客户端=new webclient (; varuri=newuri(txturl.text.trim );

client .有趣的牛排=client _ downloadstringcompleted;

client.Encoding=Encoding.UTF8; if(checkbox.checked ) )。

{var proxy=CreateProxy (); if(proxy==null )返回;

client.Proxy=proxy;

}

client.downloadstringasync(uri;

} privatevoidclient _ downloadstringcompleted (对象发送器,downloadstringcompletedeventargs ) )。

{try{

txtResult.Text=e.Result;

} Catch (执行Ex ) ) ) ) )。

{var msg=ex.Message; if(ex.innerexception!=null ) msg=ex.InnerException.Message;

messagebox.show(msg;

}

} privatevoidcheckbox _ checked changed (object sender,EventArgs e ) ) ) ) ) ) ) )

{

GB proxy.enabled=checkbox.checked;

}隐私webproxy创建代理(

{var host=txtHost.Text.Trim (; if (string.isnullorwhitespace (host ) )

{

MessageBox.Show ('请输入代理地址); 返回空值;

}var port=0; try{

port=convert.toint 32 (txt port.text.trim ();

} catch (执行) ) ) ) )。

{

MessageBox.Show ('请输入正确的代理端口); 返回空值;

} var cre=newnetworkcredential (txtusername.text,txtPwd.Text ); var proxy=new webproxy (txt host.text.trim )、port ) {Credentials=cre}; 返回代理;

}

}

}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。