private void RefreshService() { var ms = MemService.GetMemService(); this.cmbBoxPort.Items.AddRange(ms); if (ms.Length > 0) { this.cmbBoxPort.SelectedIndex = 0; } }
private void btnAdd_Click(object sender, EventArgs e) { var add = new AddFrom(); if (add.ShowDialog() == DialogResult.OK) { int port = add.Port; int mem = add.MaxMem; var s = MemService.GetMemService().FirstOrDefault(item => item.Port == port); if (s != null) { MessageBox.Show("此端口的服务已经存在...", "提示"); return; } s = MemService.AddService(port); s.Start(mem, port); this.cmbBoxPort.Items.Add(s); this.cmbBoxPort.SelectedItem = s; } }