winform是一种智能客户端技术,我们可以使用winform应用程序帮助我们获得信息或传输信息等。winform开发框架的优势就是尽量减少程序员在界面中的代码量和工作量,Model自动生成,界面以及控件自动生成,简单的逻辑自动生成。自动生成的界面已经实现简单逻辑增删改查功能。
本文我们分享一下通过Winform调用EasyGBSAPIClass.dll的过程。
1、新建一个Windows窗体应用程序
2、在项目中引用EasyGBSAPIClass
3、简单画下界面,这里给了四个按钮,分别对应上文中实现的四个反法,然后下面的TEXTBOX给出服务接口返回的数据。
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、运行看下效果
本文摘自 :https://blog.51cto.com/t