private void PopulateConnections(IList <RecentQueries> listConnections) { try { if (listConnections != null && listConnections.Count > 0) { CompareTimestamps comparator = new CompareTimestamps(); ((List <RecentQueries>)listConnections).Sort(comparator); comboBoxFilePath.Items.Clear(); comboBoxFilePath.Items.Add(Helper.GetResourceString(Common.Constants.COMBOBOX_DEFAULT_TEXT)); foreach (RecentQueries recentQuery in listConnections) { if (recentQuery.ConnParam.Host == null) { comboBoxFilePath.Items.Add(new ComboItem(recentQuery.ConnParam.Connection, recentQuery.ConnParam.ConnectionReadOnly)); } else { comboBoxFilePath.Items.Add(recentQuery.ConnParam.Connection); textBoxHost.Text = recentQuery.ConnParam.Host; textBoxPort.Text = recentQuery.ConnParam.Port.ToString(); textBoxUserName.Text = recentQuery.ConnParam.UserName; textBoxPassword.Focus(); } } if (comboBoxFilePath.Items.Count > 1) { comboBoxFilePath.SelectedIndex = 1; } } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }
private void PopulateConnections(IList<RecentQueries> listConnections) { try { if (listConnections != null && listConnections.Count > 0) { CompareTimestamps comparator = new CompareTimestamps(); ((List< RecentQueries >)listConnections).Sort(comparator); comboBoxFilePath.Items.Clear(); comboBoxFilePath.Items.Add(Helper.GetResourceString(Common.Constants.COMBOBOX_DEFAULT_TEXT)); foreach (RecentQueries recentQuery in listConnections) { if (recentQuery.ConnParam.Host == null) comboBoxFilePath.Items.Add(new ComboItem(recentQuery.ConnParam.Connection, recentQuery.ConnParam.ConnectionReadOnly)); else { comboBoxFilePath.Items.Add(recentQuery.ConnParam.Connection); textBoxHost.Text = recentQuery.ConnParam.Host; textBoxPort.Text = recentQuery.ConnParam.Port.ToString(); textBoxUserName.Text = recentQuery.ConnParam.UserName; textBoxPassword.Focus(); } } if (comboBoxFilePath.Items.Count > 1) { comboBoxFilePath.SelectedIndex = 1; } } } catch (Exception oEx) { LoggingHelper.ShowMessage(oEx); } }