Exemplo n.º 1
0
 private void LoadSetting()
 {
     this.comboBoxHost.Items.Clear();
     foreach (NTServiceHostInfo hi in Program.ConfigMgt.Config.Hosts)
     {
         NTServiceHostInfoWraper w = new NTServiceHostInfoWraper(hi);
         this.comboBoxHost.Items.Add(w);
     }
     if (this.comboBoxHost.Items.Count > 0)
     {
         this.comboBoxHost.SelectedIndex = 0;
     }
 }
Exemplo n.º 2
0
        private bool SaveSetting()
        {
            NTServiceHostInfoWraper w = this.comboBoxHost.SelectedItem as NTServiceHostInfoWraper;

            if (w == null || _mInterface == null)
            {
                return(false);
            }

            foreach (NTServiceHostInfo h in _mInterface.Hosts)
            {
                if (h.ServiceName == w.Host.ServiceName)
                {
                    MessageBox.Show(this,
                                    string.Format("The host \"{0}\" has already existed in the interface", h.ServiceName),
                                    this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    this.comboBoxHost.Focus();
                    return(false);
                }
            }

            _host = w.Host;
            return(true);
        }