當(dāng)前位置:首頁(yè) > IT技術(shù) > Windows編程 > 正文

【技術(shù)分享】通過(guò)Winform調(diào)用EasyGBSAPIClass.dll流程
2021-08-08 18:40:02

winform是一種智能客戶端技術(shù),我們可以使用winform應(yīng)用程序幫助我們獲得信息或傳輸信息等。winform開(kāi)發(fā)框架的優(yōu)勢(shì)就是盡量減少程序員在界面中的代碼量和工作量,Model自動(dòng)生成,界面以及控件自動(dòng)生成,簡(jiǎn)單的邏輯自動(dòng)生成。自動(dòng)生成的界面已經(jīng)實(shí)現(xiàn)簡(jiǎn)單邏輯增刪改查功能。

本文我們分享一下通過(guò)Winform調(diào)用EasyGBSAPIClass.dll的過(guò)程。

1、新建一個(gè)Windows窗體應(yīng)用程序

【技術(shù)分享】通過(guò)Winform調(diào)用EasyGBSAPIClass.dll流程_控件

2、在項(xiàng)目中引用EasyGBSAPIClass

【技術(shù)分享】通過(guò)Winform調(diào)用EasyGBSAPIClass.dll流程_控件_02

3、簡(jiǎn)單畫(huà)下界面,這里給了四個(gè)按鈕,分別對(duì)應(yīng)上文中實(shí)現(xiàn)的四個(gè)反法,然后下面的TEXTBOX給出服務(wù)接口返回的數(shù)據(jù)。

【技術(shù)分享】通過(guò)Winform調(diào)用EasyGBSAPIClass.dll流程_應(yīng)用程序_03

?

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)行看下效果

【技術(shù)分享】通過(guò)Winform調(diào)用EasyGBSAPIClass.dll流程_自動(dòng)生成_04

本文摘自 :https://blog.51cto.com/t

開(kāi)通會(huì)員,享受整站包年服務(wù)立即開(kāi)通 >