private void m_ComputerComboBox_ComputerChanged( object sender, DataEventArgs e ) { m_LogoPictureBox.AdminMode = ((ComputerName) e.Data).AdminMode; var computer = m_ComputerComboBox.SelectedItem as ComputerName; m_ExpandAliasButton.Enabled = (computer != null) && !string.IsNullOrEmpty( computer.Alias ); }
private void m_Presenter_ComputerListUpdated( object sender, DataEventArgs e ) { if ( this.InvokeRequired ) { this.BeginInvoke( new EventHandler<DataEventArgs>( m_Presenter_ComputerListUpdated ), sender, e ); return; } var computers = (RecentComputerList) e.Data; m_ComputerComboBox.Populate( computers ); // Put the first item in the combo's textbox if ( m_ComputerComboBox.Items.Count > 0 ) m_ComputerComboBox.SelectedIndex = 0; m_AliasComboBox.BeginUpdate(); m_AliasComboBox.Items.Clear(); m_AliasComboBox.Items.AddRange( computers.GetAliases().ToArray() ); m_AliasComboBox.MaxDropDownItems = Config.MaxComboItems; m_AliasComboBox.EndUpdate(); // Alias has been applied so can clear the textbox. m_AliasComboBox.Text = ""; this.Enabled = true; }