private void Pages_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems != null && e.NewItems.Count > 0) { WizardPage page = e.NewItems[0] as WizardPage; if (this.selectedPage == null) { this.SelectedPage = page; } if (page is WizardWelcomePage && this.welcomePage == null) { this.welcomePage = page as WizardWelcomePage; } if (page is WizardCompletionPage && this.completionPage == null) { this.completionPage = page as WizardCompletionPage; } } else if (e.Action == NotifyCollectionChangedAction.Remove && e.NewItems != null && e.NewItems.Count > 0) { WizardPage page = e.NewItems[0] as WizardPage; if (this.welcomePage == page) { this.welcomePage = null; } else if (this.completionPage == page) { this.completionPage = null; } } this.UpdateView(this.selectedPage); }
private void Pages_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add && e.NewItems != null && e.NewItems.Count > 0) { WizardPage newItem = e.NewItems[0] as WizardPage; if (this.selectedPage == null) { this.SelectedPage = newItem; } if (newItem is WizardWelcomePage && this.welcomePage == null) { this.welcomePage = newItem as WizardWelcomePage; } if (newItem is WizardCompletionPage && this.completionPage == null) { this.completionPage = newItem as WizardCompletionPage; } } else if (e.Action == NotifyCollectionChangedAction.Remove && e.NewItems != null && e.NewItems.Count > 0) { WizardPage newItem = e.NewItems[0] as WizardPage; if (this.welcomePage == newItem) { this.welcomePage = (WizardWelcomePage)null; } else if (this.completionPage == newItem) { this.completionPage = (WizardCompletionPage)null; } } this.UpdateView(this.selectedPage); this.FocusCommandButton(); }
internal void UpdateImageElements(WizardPage page) { if (page == null) { if (selectedPage == null) { return; } page = this.selectedPage; } WizardWelcomePage welcomePage = page as WizardWelcomePage; if (welcomePage != null) { if (welcomePage.WelcomeImage != null) { this.WelcomeImageElement.Image = welcomePage.WelcomeImage; } else { this.WelcomeImageElement.Image = this.WelcomeImage; } return; } WizardCompletionPage completionPage = this.SelectedPage as WizardCompletionPage; if (completionPage != null) { if (completionPage.CompletionImage != null) { this.CompletionImageElement.Image = completionPage.CompletionImage; } else { this.CompletionImageElement.Image = this.CompletionImage; } } }