Beispiel #1
0
        public ServerEditForm()
        {
            InitializeComponent();
            IPAddress[] ips = Dns.GetHostAddresses(Dns.GetHostName());
            foreach (IPAddress ip in ips)
            {
                if (ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    this.cboIps.Items.Add(ip.ToString());
                }
            }

            config = DbClient.ReadServerConfig();
            if (config != null)
            {
                this.txtName.Text      = config.Name;
                this.cboIps.Text       = config.IP;
                this.txtPort.Text      = config.Port.ToString();
                this.chkEnable.Checked = config.IsEnable;
            }
            else
            {
                this.txtName.Text         = "";
                this.cboIps.SelectedIndex = ips.Length > 0 ? 0 : -1;
                this.txtPort.Text         = "5000";
                this.chkEnable.Checked    = false;
            }
        }