public void Connect(Kohl.Framework.Security.Credential credentials) { progress.Visible = true; splitContainer1.Visible = false; this.SelectedSession = null; this.dataGridView1.DataSource = null; this.dataGridView2.DataSource = null; this.propertyGrid1.SelectedObject = null; this.server = TerminalServer.LoadServer(this.ServerNameComboBox.Text, credentials); progress.Visible = false; splitContainer1.Visible = true; if (this.server.IsTerminalServer) { this.dataGridView1.DataSource = this.server.Sessions; if (this.dataGridView1.Columns.Count > 0) { this.dataGridView1.Columns[1].Visible = false; } if (this.server.Sessions == null) { MessageBox.Show("Terminals was unable to enumerate your server's sessions." + (this.server.Errors != null & this.server.Errors.Count > 0 ? "\n" + this.server.Errors[0] : "")); } } else { MessageBox.Show("This machine does not appear to be a terminal server."); } }
private void CheckForTS(object state) { IFavorite favorite = state as IFavorite; try { Thread.Sleep(3000); this.Server = TerminalServer.LoadServer(favorite.ServerName); this.IsTerminalServer = this.Server.IsATerminalServer; } catch (Exception exception) { const string MESSAGE = "Checked to see if {0} is a terminal server. {0} is not a terminal server"; string message = String.Format(MESSAGE, favorite.ServerName); Logging.Error(message, exception); } }
private void button1_Click(object sender, EventArgs e) { this.SelectedSession = null; this.dataGridView1.DataSource = null; this.dataGridView2.DataSource = null; this.propertyGrid1.SelectedObject = null; Application.DoEvents(); this.server = TerminalServer.LoadServer(this.ServerNameComboBox.Text); if (this.server.IsATerminalServer) { this.dataGridView1.DataSource = this.server.Sessions; this.dataGridView1.Columns[1].Visible = false; } else { MessageBox.Show("This machine does not appear to be a terminal server."); } }
private void ConnectButton_Click(object sender, EventArgs e) { if (this.ParentForm != null) { this.ParentForm.Cursor = Cursors.WaitCursor; } this.selectedSession = null; dataGridView1.DataSource = null; dataGridView2.DataSource = null; this.propertyGrid1.SelectedObject = null; Application.DoEvents(); server = TerminalServer.LoadServer(this.ServerNameComboBox.Text); try { if (server.IsATerminalServer) { dataGridView1.DataSource = server.Sessions; dataGridView1.Columns[1].Visible = false; } else { MessageBox.Show("This machine does not appear to be a Terminal Server"); } } catch (Exception) { // Do nothing when error } if (this.ParentForm != null) { this.ParentForm.Cursor = Cursors.Default; } }