NetCfg_Form.cs 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace VzClientSDKDemo
  10. {
  11. public partial class NetCfg_Form : Form
  12. {
  13. private string m_strIP;
  14. private uint m_nSL = 0;
  15. private uint m_nSH = 0;
  16. private string m_strNetmask;
  17. private string m_strGateway;
  18. public NetCfg_Form()
  19. {
  20. InitializeComponent();
  21. }
  22. public void SetNetParam(string strIP, uint SL, uint SH, string netmask, string gateway)
  23. {
  24. m_strIP = strIP;
  25. m_nSL = SL;
  26. m_nSH = SH;
  27. m_strNetmask = netmask;
  28. m_strGateway = gateway;
  29. }
  30. private void btnSave_Click(object sender, EventArgs e)
  31. {
  32. string strIP = txtIP.Text;
  33. string strNetmask = txtMask.Text;
  34. string strGateway = txtGateway.Text;
  35. int ret = VzClientSDK.VzLPRClient_UpdateNetworkParam(m_nSH, m_nSL, strIP, strGateway, strNetmask);
  36. if (ret == 2)
  37. {
  38. MessageBox.Show("设备IP跟网关不在同一网段,请重新输入!");
  39. }
  40. else if (ret == -1)
  41. {
  42. MessageBox.Show("修改网络参数失败,请重新输入!");
  43. }
  44. MessageBox.Show("修改网络参数成功");
  45. }
  46. private void NetCfg_Form_Load(object sender, EventArgs e)
  47. {
  48. txtIP.Text = m_strIP;
  49. txtMask.Text = m_strNetmask;
  50. txtGateway.Text = m_strGateway;
  51. }
  52. }
  53. }