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

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

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

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

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

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

2、在項目中引用EasyGBSAPIClass

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

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

【技術(shù)分享】通過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、運行看下效果

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

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

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