private void FrmMain_Load(object sender, EventArgs e) { MyClients.TabControlMain = this.tabControlMain; MyClients.FrmMain = this; UserControl ctr = new ucWinServiceMgr(); tabWinServiceMgr.Controls.Add(ctr); Task.Factory.StartNew(LoopToReadServiceStatus); }
private void window服务ToolStripMenuItem_Click(object sender, EventArgs e) { bool flag = false; foreach (var item in tabWinServiceMgr.Controls) { if (item is ucWinServiceMgr) { flag = true; } } if (!flag) { UserControl ctr = new ucWinServiceMgr(); tabWinServiceMgr.Controls.Add(ctr); } }