src/Misc/EFTools/EntityDesign/VisualStudio/ModelWizard/gui/WizardPageSelectTables.cs
// <summary>
//     RunWorkerCompleted event handler: Populate Treeview here.
//     This method is called by background worker component on the same thread as the UI thread.
//     ModelBuilderEngine gaves us table names to display so we add them to the TreeView
// </summary>
RunWorkerCompleted event handler: Populate Treeview here.
This method is called by background worker component on the same thread as the UI thread.
ModelBuilderEngine gaves us table names to display so we add them to the TreeView
RunWorkerCompleted event handler : Populate Treeview here . This method is called by background worker component on the same thread as the UI thread . ModelBuilderEngine gaves us table names to display so we add them to the TreeView
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
        protected void bgWorkerPopulateTree_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs args)
        {
            try
            {
                _stopwatch.Stop();
                if (args.Cancelled)
                {
                    return;
                }
                if (args.Error != null)
                {
                    ModelBuilderWizardForm.ShowDatabaseConnectionErrorDialog(args.Error);
                    Visited = false;
                    Wizard.OnPrevious();
                }
                else
                {
                    using (new VsUtils.HourglassHelper())
                    {
                        var result = (ICollection<EntityStoreSchemaFilterEntry>[])args.Result;
                        var tableEntries = result[0];
                        var viewEntries = result[1];
                        var sprocEntries = result[2];
                        CreateTreeForNewModel(tableEntries, viewEntries, sprocEntries);
                        if (sprocEntries != null && sprocEntries.Count > 0)
                        {
                            chkCreateFunctionImports.Enabled = true;
                            chkCreateFunctionImports.Checked = true;
                        }
                        databaseObjectTreeView.HideStatus();
                        databaseObjectTreeView.TreeViewControl.SelectedNode = databaseObjectTreeView.TreeViewControl.Nodes[0];
                        databaseObjectTreeView.Focus();
                        _initializedDataConnection = Wizard.ModelBuilderSettings.DesignTimeConnectionString;
                        _initializedUsingLegacyProvider = Wizard.ModelBuilderSettings.UseLegacyProvider;
                        _initializedGenerationOption = Wizard.ModelBuilderSettings.GenerationOption;
                        modelNamespaceTextBox.Enabled = Wizard.ModelBuilderSettings.GenerationOption != ModelGenerationOption.CodeFirstFromDatabase;
                    }
                }
                Wizard.OnValidationStateChanged(this);
            }
            catch (Exception e)
            {
                databaseObjectTreeView.ShowStatus(
                    String.Format(
                        CultureInfo.CurrentCulture,
                        ModelWizard.Properties.Resources.SelectTablesPage_ErrorRetrievingTablesText, e.Message));
                Wizard.EnableButton(ButtonType.Cancel, true);
            }
        }
[ SuppressMessage ( " " , " " ) ] protected void bgWorkerPopulateTree_RunWorkerCompleted ( object sender , RunWorkerCompletedEventArgs args ) { try { _stopwatch . Stop ( ) ; if ( args . Cancelled ) { return ; } if ( args . Error != null ) { ModelBuilderWizardForm . ShowDatabaseConnectionErrorDialog ( args . Error ) ; Visited = false ; Wizard . OnPrevious ( ) ; } else { using ( new VsUtils . HourglassHelper ( ) ) { var result = ( ICollection < EntityStoreSchemaFilterEntry > [ ] ) args . Result ; var tableEntries = result [ 0 ] ; var viewEntries = result [ 1 ] ; var sprocEntries = result [ 2 ] ; CreateTreeForNewModel ( tableEntries , viewEntries , sprocEntries ) ; if ( sprocEntries != null && sprocEntries . Count > 0 ) { chkCreateFunctionImports . Enabled = true ; chkCreateFunctionImports . Checked = true ; } databaseObjectTreeView . HideStatus ( ) ; databaseObjectTreeView . TreeViewControl . SelectedNode = databaseObjectTreeView . TreeViewControl . Nodes [ 0 ] ; databaseObjectTreeView . Focus ( ) ; _initializedDataConnection = Wizard . ModelBuilderSettings . DesignTimeConnectionString ; _initializedUsingLegacyProvider = Wizard . ModelBuilderSettings . UseLegacyProvider ; _initializedGenerationOption = Wizard . ModelBuilderSettings . GenerationOption ; modelNamespaceTextBox . Enabled = Wizard . ModelBuilderSettings . GenerationOption != ModelGenerationOption . CodeFirstFromDatabase ; } } Wizard . OnValidationStateChanged ( this ) ; } catch ( Exception e ) { databaseObjectTreeView . ShowStatus ( String . Format ( CultureInfo . CurrentCulture , ModelWizard . Properties . Resources . SelectTablesPage_ErrorRetrievingTablesText , e . Message ) ) ; Wizard . EnableButton ( ButtonType . Cancel , true ) ; } }
RunWorkerCompleted event handler: Populate Treeview here.
RunWorkerCompleted event handler : Populate Treeview here .
// show error dialog // No errors, populate nodes in TreeView - create the nodes accordingly // if there are Sproc entries then enable the Create Function Imports box and by default set to checked // Hide status message // Set focus to TreeView // Enable wizard navigation
sender
object
args
RunWorkerCompletedEventArgs