private void RefreshServiceList() { cmbServiceList.DataSource = WinServiceConfigReader.GetWinServices(); cmbServiceList.DisplayMember = WinServiceConfigReader.SERVICE; cmbServiceList.ValueMember = WinServiceConfigReader.SERVICE; cmbServiceList.SelectedIndex = 0; }
private void FrmEditSvcList_Load(object sender, EventArgs e) { foreach (var item in WinServiceConfigReader.GetWinServices()) { lsbServices.Items.Add(item); } lsbServices.DisplayMember = "ShowText"; lsbServices.ValueMember = "Service"; lsbServices.ContextMenuStrip = this.contextMenuStrip1; }
private void btnSave_Click(object sender, EventArgs e) { var list = new List <WinServiceConfig>(); foreach (var item in lsbServices.Items) { var t = item as WinServiceConfig; if (t != null) { list.Add(t); } } WinServiceConfigReader.SetWinServices(list, false); this.Close(); }