예제 #1
0
 /// <summary>
 /// 远程主机选择处理
 /// </summary>
 /// <param name="remoteHost"></param>
 private void RemohostSelect(DH_REMOTE_HOST remoteHost)
 {
     txtHostIPAddr.Text = DHClient.DHByteArrayToString(remoteHost.sHostIPAddr);
     txtHostPassword.Text = DHClient.DHByteArrayToString(remoteHost.sHostPassword);
     txtHostPort.Text = remoteHost.wHostPort.ToString();
     txtHostUserName.Text = DHClient.DHByteArrayToString(remoteHost.sHostUser);
     chkHostEnable.Checked = (remoteHost.byEnable == 1 ? true : false);
 }
예제 #2
0
 /// <summary>
 /// 远程主机选择处理
 /// </summary>
 /// <param name="remoteHost"></param>
 private void RemohostSaveData(ref DH_REMOTE_HOST remoteHost)
 {
     DHClient.DHStringToByteArry(txtHostIPAddr.Text, ref remoteHost.sHostIPAddr);
     DHClient.DHStringToByteArry(txtHostPassword.Text, ref remoteHost.sHostPassword);
     remoteHost.wHostPort = ushort.Parse(txtHostPort.Text);
     DHClient.DHStringToByteArry(txtHostUserName.Text,ref  remoteHost.sHostUser);
     remoteHost.byEnable = (byte)(chkHostEnable.Checked == true ? 1 : 0);
 }
예제 #3
0
        /// <summary>
        /// 远程主机选择
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbRemohost_SelectedIndexChanged(object sender, EventArgs e)
        {
            labIPorHostNameTitle.Visible = false;
            txtIPorHostName.Visible = false;
            labIPorHostNameTitle.Text = ":";
            txtIPorHostName.Text = "";
            if (netConfig.Equals(new DHDEV_NET_CFG()) == false && cmbRemohost.SelectedIndex != -1)
            {
                DH_REMOTE_HOST remoteHost = new DH_REMOTE_HOST();
                int selectIndex=cmbRemohost.SelectedIndex;
                #region << 控件有效无效处理 >>
                switch (selectIndex)
                {
                    case 0://报警服务器
                    case 1://日志服务器
                    case 2://SMTP服务器
                    case 3://多播组
                        chkHostEnable.Enabled = false;
                        txtHostIPAddr.Enabled = true;
                        txtHostPort.Enabled = true;
                        txtHostUserName.Enabled = false;
                        txtHostPassword.Enabled = false;
                        break;
                    case 4:////NFS服务器
                        chkHostEnable.Enabled = true;
                        txtHostIPAddr.Enabled = true;
                        txtHostPort.Enabled = true;
                        txtHostUserName.Enabled = true;
                        txtHostPassword.Enabled = true;
                        break;
                    case 5://PPPoE服务器
                        chkHostEnable.Enabled = true;
                        txtHostIPAddr.Enabled = false;
                        txtHostPort.Enabled = false;
                        txtHostUserName.Enabled = true;
                        txtHostPassword.Enabled = true;
                        break;
                    case 6://DDNS服务器
                        chkHostEnable.Enabled = true;
                        txtHostIPAddr.Enabled = true;
                        txtHostPort.Enabled = true;
                        txtHostUserName.Enabled = false;
                        txtHostPassword.Enabled = false;
                        break;
                    case 7://DNS服务器
                        chkHostEnable.Enabled = false;
                        txtHostIPAddr.Enabled = true;
                        txtHostPort.Enabled = false;
                        txtHostUserName.Enabled = false;
                        txtHostPassword.Enabled = false;
                        break;
                }
                #endregion
                
                switch (selectIndex)
                {
                    case 0://报警服务器
                        remoteHost = netConfig.struAlarmHost;
                        break;
                    case 1://日志服务器
                        remoteHost = netConfig.struLogHost;
                        break;
                    case 2://SMTP服务器
                        remoteHost = netConfig.struSmtpHost;
                        break;
                    case 3://多播组
                        remoteHost = netConfig.struMultiCast;
                        break;
                    case 4://NFS服务器
                        remoteHost = netConfig.struNfs;
                        break;
                    case 5://PPPoE服务器
                        remoteHost = netConfig.struPppoe;
                        labIPorHostNameTitle.Visible = true;
                        txtIPorHostName.Visible = true;
                        labIPorHostNameTitle.Text = "注册IP:";
                        txtIPorHostName.Text = DHClient.DHByteArrayToString(netConfig.sPppoeIP);
                        break;
                    case 6://DDNS服务器
                        remoteHost = netConfig.struDdns;
                        labIPorHostNameTitle.Visible = true;
                        txtIPorHostName.Visible = true;
                        labIPorHostNameTitle.Text = "DDNS主机名:";
                        txtIPorHostName.Text = DHClient.DHByteArrayToString(netConfig.sDdnsHostName);
                        break;
                    case 7://DNS服务器
                        remoteHost = netConfig.struDns;
                        break;
                }
                if (remoteHost.Equals(new DH_REMOTE_HOST()) == false)
                {
                    RemohostSelect(remoteHost);
                }

            }
        }