Exemplo n.º 1
0
        private void newDBConnectionButton_Click(object sender, EventArgs e)
        {
            try
            {
                var dialog = new EntityDataConnectionDialog(Wizard.Project);
                dialog.ShowDialog();

                Debug.Assert(
                    dialog.SelectedConnection != null && dialog.SelectedExplorerConnection != null,
                    "Either the selected connection or selected explorer connection is null");
                if (dialog.SelectedConnection != null &&
                    dialog.SelectedExplorerConnection != null)
                {
                    var index =
                        dataSourceComboBox.Items.Add(
                            new DataSourceComboBoxItem(dialog.SelectedExplorerConnection.DisplayName, dialog.SelectedConnection));

                    // changing the selection in the combo box will cause the NewDataSourceSelected() to be called
                    dataSourceComboBox.SelectedIndex = index;
                }
            }
            catch (Exception ex)
            {
                VsUtils.ShowErrorDialog(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void newDBConnectionButton_Click(object sender, EventArgs e)
        {
            try
            {
                var dialog = new EntityDataConnectionDialog(Wizard.Project);
                dialog.ShowDialog();

                // the below values may be null if e.g. the user hit Cancel on the dialog
                // without selecting a connection
                if (dialog.SelectedConnection != null &&
                    dialog.SelectedExplorerConnection != null)
                {
                    var index =
                        dataSourceComboBox.Items.Add(
                            new DataSourceComboBoxItem(dialog.SelectedExplorerConnection.DisplayName, dialog.SelectedConnection));

                    // changing the selection in the combo box will cause the NewDataSourceSelected() to be called
                    dataSourceComboBox.SelectedIndex = index;
                }
            }
            catch (Exception ex)
            {
                VsUtils.ShowErrorDialog(ex.Message);
            }
        }