//添加tagpage页面并添加AxMsRdpClient9NotSafeForScripting组件 public void button4_Click(String server, String userName, String passWord, String serverName) { try { int i1 = 1; TabPage Page = new TabPage(); Page.Text = serverName; Page.Tag = index + i1; Page.UseVisualStyleBackColor = true; this.tabControl1.Controls.Add(Page); this.tabControl1.SelectedTab = Page; connect(server, userName, passWord); serverEntity serverentity = new serverEntity(); serverentity.Server = server; serverentity.Username = userName; serverentity.Password = passWord; dictionary.Add(tabControl1.SelectedTab.Tag.ToString(), serverentity); index++; } catch (Exception ex) { Logger.Error(ex.Message); return; } }
private void Form2_Load_1(object sender, EventArgs e) { try { tabControl1.TabPages[0].Text = serverName; this.comboBox1.Text = this.comboBox1.Items[0].ToString(); connect(Server, Username, Password); serverentity = new serverEntity(); serverentity.Server = Server; serverentity.Username = Username; serverentity.Password = Password; dictionary.Add(this.tabControl1.SelectedTab.Tag.ToString(), serverentity); //this.timer1.Start(); Logger.Info("服务启动加载成功----" + DateTime.Now.ToString()); } catch (Exception ex) { Logger.Error(ex.Message); } }