winform是一種智能客戶端技術(shù),我們可以使用winform應(yīng)用程序幫助我們獲得信息或傳輸信息等。winform開發(fā)框架的優(yōu)勢(shì)就是盡量減少程序員在界面中的代碼量和工作量,Model自動(dòng)生成,界面以及控件自動(dòng)生成,簡(jiǎn)單的邏輯自動(dòng)生成。自動(dòng)生成的界面已經(jīng)實(shí)現(xiàn)簡(jiǎn)單邏輯增刪改查功能。
本文我們分享一下通過Winform調(diào)用EasyGBSAPIClass.dll的過程。
1、新建一個(gè)Windows窗體應(yīng)用程序
2、在項(xiàng)目中引用EasyGBSAPIClass
3、簡(jiǎn)單畫下界面,這里給了四個(gè)按鈕,分別對(duì)應(yīng)上文中實(shí)現(xiàn)的四個(gè)反法,然后下面的TEXTBOX給出服務(wù)接口返回的數(shù)據(jù)。
?
private void Form1_Load(object sender, EventArgs e)
{
EasyGBSAPIClass.EasyGBSAPIClass.IP = IP;
EasyGBSAPIClass.EasyGBSAPIClass.port = port;
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
string username = "easygbs";
string password = "EasyGBS@2020";
string outstring=EasyGBSAPIClass.EasyGBSAPIClass.Login(username,password);
textBox1.Text = outstring;
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
string outstring = EasyGBSAPIClass.EasyGBSAPIClass.GetDeviceList(0, 10, "", "ID", "ASC", true);
textBox1.Text = outstring;
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = "";
string outstring = EasyGBSAPIClass.EasyGBSAPIClass.GetDeviceChannelList("34020000001130000001", "", 0, 10, true, "", "", "Channel", "ASC");
textBox1.Text = outstring;
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text = "";
string outstring = EasyGBSAPIClass.EasyGBSAPIClass.StreamStart("34020000001130000001","34020000001320000001");
textBox1.Text = outstring;
}
4、運(yùn)行看下效果
本文摘自 :https://blog.51cto.com/t