public MetadataContainerLoadWindow(object owner, MetadataContainer metadataContainer, BaseConnectionDescriptor connection = null) { Debug.Assert(metadataContainer != null); _owner = owner; _pages = new List <WizardPageInfo>(); // store reference to edited object EditedMetadataContainer = metadataContainer; _initialConnection = connection; Connection = connection; // create new SQLContext for loading _temporarySqlContext = new SQLContext(); _temporarySqlContext.Assign(EditedMetadataContainer.SQLContext); // create temporary MetadataContainer TemporaryMetadataContainer = new MetadataContainer(_temporarySqlContext); _temporarySqlContext.MetadataContainer = TemporaryMetadataContainer; TemporaryMetadataContainer.Assign(EditedMetadataContainer); TemporaryMetadataContainer.LoadingOptions = new MetadataLoadingOptions(); TemporaryMetadataContainer.LoadingOptions.Assign(EditedMetadataContainer.LoadingOptions); InitializeComponent(); // set up pages _wizardPageWelcome = new WelcomeWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageWelcome); _wizardPageConnectionType = new ConnectionTypeWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageConnectionType); _wizardPageMetadataOpts = new MetadataOptsWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageMetadataOpts); _wizardPageLoadOpts = new LoadOptsWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageLoadOpts); _wizardPageFilter = new FilterWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageFilter); _wizardPageLoading = new LoadingWizardPage { Visibility = Visibility.Collapsed }; GridRoot.Children.Add(_wizardPageLoading); _pages.Add(new WizardPageInfo(ShowWelcome)); _pages.Add(new WizardPageInfo(ShowConnection, CheckConnectionSelected)); _pages.Add(new WizardPageInfo(ShowMetadataOpts, CheckShowMetadataOpts, true, BeforeMetadataOpts)); _pages.Add(new WizardPageInfo(ShowLoadOpts, CheckLoadOpts, (_temporarySqlContext.SyntaxProvider != null && _temporarySqlContext.SyntaxProvider.IsSupportDatabases()), BeforeLoadOpts)); _pages.Add(new WizardPageInfo(ShowFilter, CheckFilter)); _pages.Add(new WizardPageInfo(ShowLoading)); _currentPage = 0; _pages[_currentPage].ShowProc(); _wizardPageMetadataOpts.bConnectionTest.Click += buttonConnectionTest_Click; _wizardPageConnectionType.ComboBoxConnectionType.SelectionChanged += cbConnectionType_SelectedIndexChanged; _wizardPageConnectionType.ComboBoxSyntaxProvider.SelectionChanged += ComboBoxSyntaxProvider_SelectedIndexChanged; bBack.Click += buttonBack_Click; bNext.Click += buttonNext_Click; Loaded += MetadataContainerLoadForm_Load; Localize(); Loaded += MetadataContainerLoadForm_Loaded; var propertyLanguage = DependencyPropertyDescriptor.FromProperty(LanguageProperty, typeof(MetadataContainerLoadWindow)); propertyLanguage.AddValueChanged(this, LanguagePropertyChanged); }
public MetadataContainerLoadForm(MetadataContainer metadataContainer, BaseConnectionDescriptor connection = null) { Debug.Assert(metadataContainer != null); _pages = new List <WizardPageInfo>(); // store reference to edited object EditedMetadataContainer = metadataContainer; _initialConnection = connection; _connection = connection; // create new SQLContext for loading _temporarySQLContext = new SQLContext(); _temporarySQLContext.Assign(EditedMetadataContainer.SQLContext); // create temporary MetadataContainer TemporaryMetadataContainer = new MetadataContainer(_temporarySQLContext); _temporarySQLContext.MetadataContainer = TemporaryMetadataContainer; TemporaryMetadataContainer.Assign(EditedMetadataContainer); TemporaryMetadataContainer.LoadingOptions = new MetadataLoadingOptions(); TemporaryMetadataContainer.LoadingOptions.Assign(EditedMetadataContainer.LoadingOptions); InitializeComponent(); // set up pages _wizardPageWelcome = new WelcomeWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageWelcome); _wizardPageConnectionType = new ConnectionTypeWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageConnectionType); _wizardPageMetadataOpts = new MetadataOptsWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageMetadataOpts); _wizardPageLoadOpts = new LoadOptsWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageLoadOpts); _wizardPageFilter = new FilterWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageFilter); _wizardPageLoading = new LoadingWizardPage { Dock = DockStyle.Fill, Visible = false }; Controls.Add(_wizardPageLoading); _pages.Add(new WizardPageInfo(ShowWelcome)); _pages.Add(new WizardPageInfo(ShowConnection, CheckConnectionSelected)); _pages.Add(new WizardPageInfo(ShowMetadataOpts, CheckShowMetadataOpts, true, BeforeMetadataOpts)); _pages.Add(new WizardPageInfo(ShowLoadOpts, CheckLoadOpts, (_temporarySQLContext.SyntaxProvider != null && _temporarySQLContext.SyntaxProvider.IsSupportDatabases()), BeforeLoadOpts)); _pages.Add(new WizardPageInfo(ShowFilter, CheckFilter)); _pages.Add(new WizardPageInfo(ShowLoading)); _currentPage = 0; _pages[_currentPage].showProc(); _wizardPageMetadataOpts.bConnectionTest.Click += buttonConnectionTest_Click; _wizardPageConnectionType.cbConnectionType.SelectedIndexChanged += cbConnectionType_SelectedIndexChanged; _wizardPageConnectionType.cbSyntax.SelectedIndexChanged += cbSyntax_SelectedIndexChanged; bBack.Click += buttonBack_Click; bNext.Click += buttonNext_Click; Load += MetadataContainerLoadForm_Load; }