protected override Task ExecuteShowAsync(IWizardPage fromPage) { CanGoPreviousPage = false; CanGoCancel = false; this.lblTitle.Text = Title; this.lblDescription.Text = Description; return base.ExecuteShowAsync(fromPage); }
public void SetCurrentPage(IWizardPage wizardPage) { IsCurrent = wizardPage == Page; foreach (var child in children) { child.SetCurrentPage(wizardPage); } }
protected override Task ExecuteShowAsync(IWizardPage fromPage) { if (fromPage is LicensePage) { rbStandard.Checked = true; txtInstPath.Text = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86); } return base.ExecuteShowAsync(fromPage); }
// Add page public void AddPage(IWizardPage page) { Control ctrl = (Control)page; panel主体.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; page.StateChanged += new EventHandler(page_StateChanged); //page.Reset += new EventHandler(page_Reset); }
// Add page public void AddPage(IWizardPage page) { Control ctrl = (Control) page; workPanel.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; //this.Height = this.Height + ctrl.Height - workPanel.Height; //this.Width = this.Width + ctrl.Width - workPanel.Width; page.StateChanged += new EventHandler(page_StateChanged); page.Reset += new EventHandler(page_Reset); }
protected override Task ExecuteShowAsync(IWizardPage fromPage) { var bytes = Encoding.ASCII.GetBytes(Resources.Apache20); using (var memoryStream = new MemoryStream(bytes)) { this.txtLicense.LoadFile(memoryStream, RichTextBoxStreamType.RichText); } rbNotAgree.Checked = true; this.UpdateControlState(); return base.ExecuteShowAsync(fromPage); }
public PageNavigationTreeEntry(IWizardPage page) { Page = page; children = new ObservableCollection<PageNavigationTreeEntry>(); Children = new ReadOnlyObservableCollection<PageNavigationTreeEntry>(children); page.PropertyChanged += PagePropertyChanged; (page.Children as INotifyCollectionChanged).CollectionChanged += PageChildCollectionChanged; foreach (IWizardPage c in page.Children) { children.Add(new PageNavigationTreeEntry(c)); } }
// Add page public void AddPage(IWizardPage page) { Control ctrl = (Control) page; // add new tab TabPage tabPage = new TabPage(); tabPage.TabIndex = tabControl.TabCount; tabPage.Text = page.PageName; tabControl.Controls.Add(tabPage); // add page to tab tabPage.Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; page.StateChanged += new EventHandler(page_StateChanged); }
private void Visit(IWizardPage node) { if (First == null && node != rootNode) { First = node; } // Would update the Last node everytime, but if the only // node is the root node, then this will be wrong. if (node != rootNode) { Last = node; } if (!found) { if (node.Equals(nodeToFind)) { found = true; } else { // Whilst not found, keep updating previous, last update // will be the one before the searched for node! if (node != rootNode) { previous = node; } } } else { if (Next == null) { Next = node; } } foreach (var child in node.Children) { Visit(child); } }
public ConfigureWizard() { InitializeComponent(); Text = ResourceLookup.UI_ConfigureWizard_Title; logbook = Plugin.Instance.Application != null ? Plugin.Instance.Application.Logbook : null; settings = new LogbookSettings(); if (logbook != null) { settings.Load(logbook); } accountInfoPage = new ConfigureWizard_Page_AccountInfo(this); selectUserPage = new ConfigureWizard_Page_SelectUser(this); importSettingsPage = new ConfigureWizard_Page_ImportSettings(this); importHistoryPage = new ConfigureWizard_Page_ImportHistory(this); Pages = new IWizardPage[] { accountInfoPage, selectUserPage, importSettingsPage, importHistoryPage }; }
protected override async Task ExecuteShowAsync(IWizardPage fromPage) { CanGoPreviousPage = false; CanGoNextPage = false; CanGoFinishPage = false; CanGoCancel = false; var folderPath = Environment.GetFolderPath(Environment.SpecialFolder.System); var directoryInfo = new DirectoryInfo(folderPath); var files = directoryInfo.GetFiles(); progressBar.Minimum = 1; progressBar.Maximum = files.Length; var progressIndicator = new Progress<int>(i => { progressBar.Value = i; lblFileName.Text = files[i - 1].Name; lblFileName.Refresh(); }); await UpdateFileProgressAsync(files, progressIndicator); await NextAsync(); }
public void AddChild(IWizardPage newItem) { children.Add(newItem); OnPropertyChanged("Children"); }
protected bool AllowPrevious() { IWizardPage currentWizardPage = this.GetCurrentWizardPage(base.wizardProgress.CurrentStepTabPage); return((currentWizardPage != null) && currentWizardPage.EnablePrevious()); }
/// <summary> /// Called when the WizardPage becomes ready to allow redirection by directly using the Wizard /// </summary> /// <param name="previousPage"></param> /// <param name="currentLocation"></param> /// <param name="reason"></param> public virtual void ReadyToPerformRedirections(IWizardPage previousPage, WizardNavigationLocation currentLocation, WizardNavigationReasons reason) { }
private bool AllowFinish() { IWizardPage currentWizardPage = this.GetCurrentWizardPage(base.wizardProgress.CurrentStepTabPage); return((currentWizardPage != null) && currentWizardPage.EnableFinish()); }
/// <summary> /// Notifies a page that it is ready to and allowed to perform automatic redirection using the wizard directly /// </summary> /// <param name="wizardPage"></param> /// <param name="previousPage"></param> /// <param name="location"></param> /// <param name="reason"></param> /// <param name="throwExceptions"></param> /// <returns></returns> public bool NotifyPageItIsReadyToPerformRedirections(IWizardPage wizardPage, IWizardPage previousPage, WizardNavigationLocation location, WizardNavigationReasons reason, bool throwExceptions) { if (wizardPage != null) { try { wizardPage.ReadyToPerformRedirections(previousPage, location, reason); return true; } catch(Exception ex) { Trace.WriteLine(ex); if (throwExceptions) throw new Exception(ex.Message, ex); } } return false; }
public static Task MoveForwardOrResumeAsync(this IWizardPage wizardPage) { Argument.IsNotNull(() => wizardPage); return(wizardPage.Wizard.MoveForwardOrResumeAsync()); }
/// <summary> /// Activates a page /// </summary> /// <param name="wizardPage"></param> /// <param name="previousPage"></param> /// <param name="location"></param> /// <param name="throwExceptions"></param> /// <returns></returns> public bool ActivatePage(IWizardPage wizardPage, IWizardPage previousPage, WizardNavigationLocation location, WizardNavigationReasons reason, bool throwExceptions) { if (wizardPage != null) { try { wizardPage.Activate(previousPage, location, reason); // figure out the names of the possible routes away from this location string[] names = location.Paths.GetPathNames(); string pathNames = string.Join(", ", names); Debug.WriteLine(string.Format("The location represented by the '{0}' WizardPage has '{1}' possible routes.\n\tThey are as follows '{2}' with the page types to which they point.", location.WizardPageType.Name, location.Paths.Count, pathNames)); foreach(WizardNavigationPath path in location.Paths) Debug.WriteLine(string.Format("\t'{0}' = {1}", path.Name, path.Destination.WizardPageType.Name)); return true; } catch(Exception ex) { Trace.WriteLine(ex); if (throwExceptions) throw new Exception(ex.Message, ex); } } return false; }
/// <summary> /// Adds the page. /// </summary> /// <param name="page">The page.</param> public void AddPage(IWizardPage page) { _pages.Add(page); RefreshNavigationButtons(); }
protected override Task ExecuteShowAsync(IWizardPage fromPage) { this.txtSummary.Text = Wizard.GetWizardModel<FeaturePage.Model>().ToString(); return base.ExecuteShowAsync(fromPage); }
protected virtual void ShowPage(int pageIndex) { _curPageIndex = pageIndex; if (_curPage != null) { _curPage.Deactivated(_context); // Perform clean up _curPage.OnChange -= new EventHandler(page_OnChange); } _curPage = _pages[pageIndex] as IWizardPage; _curPage.Activated(_context); _curPage.OnChange += new EventHandler(page_OnChange); pageContainer.Controls.Clear(); pageContainer.Controls.Add(_curPage.InnerControl); UpdateNavButtons(); }
public void AddPage(IWizardPage page) { page.Initialize(_model, _context); _pages.Add(page); }
public void RemoveChild(IWizardPage item) { children.Remove(item); OnPropertyChanged("Children"); }
public void AddChild(IWizardPage newItem) { children.Add(newItem); }
/// <summary> /// Deactivates a page /// </summary> /// <param name="wizardPage"></param> /// <param name="throwExceptions"></param> /// <returns></returns> public bool DeactivatePage(IWizardPage wizardPage, WizardNavigationReasons reason, bool throwExceptions) { if (wizardPage != null) { try { wizardPage.Deactivate(reason); return true; } catch(Exception ex) { Trace.WriteLine(ex); if (throwExceptions) throw new Exception(ex.Message, ex); } } return false; }
private void PropertyChangedHandler(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == "SelectedDecoderIndex") { if (IsCustom) { if (customPage == null) { customPage = new CustomMessageDecoderPage(); } if (!Children.Contains(customPage)) { AddChild(customPage); } ShowCustomWarning = true; } else { ShowCustomWarning = false; if (Children.Any()) { children.Clear(); OnPropertyChanged("Children"); } } } }
/// <summary> /// Adds the given page to the wizard. /// </summary> /// <param name="page">Page to add</param> public void AddWizardPage(IWizardPage page) { iWizardPages.Add(page); page.Wizard = this; }
/// <summary> /// Removes the page. /// </summary> /// <param name="page">The page.</param> public void RemovePage(IWizardPage page) { _pages.Remove(page); RefreshNavigationButtons(); }
protected override Task ExecuteShowAsync(IWizardPage fromPage) { this.lblTitle.Text = this.Title; this.lblDescription.Text = this.Description; return base.ExecuteShowAsync(fromPage); }
public void RemoveChild(IWizardPage item) { children.Remove(item); }
public new void ShowPage(IWizardPage page) { int requiredHeight = page.CreatePageControl().Height + m_ExcessWizardHeight; base.ShowPage(page); if (requiredHeight > m_BaseWizardHeight) { // Realign the center this.Top += (this.Height - requiredHeight) / 2; this.Height = requiredHeight; } else if(this.Height != m_BaseWizardHeight) { // Realign the center this.Top += (this.Height - m_BaseWizardHeight) / 2; // Set back to our default value this.Height = m_BaseWizardHeight; } this.Invalidate(); }
public void NavigateTo(IWizardPage page) { NavigateTo(_pages.IndexOf(page)); }
/// <summary> /// Called when the WizardPage becomes active /// </summary> /// <param name="previousPage">The WizardPage that was the previous active page</param> /// <param name="currentLocation">The WizardNavigationLocation that directed the Wizard to this WizardPage</param> public virtual void Activate(IWizardPage previousPage, WizardNavigationLocation currentLocation, WizardNavigationReasons reason) { _active = true; _currentLocation = currentLocation; Debug.WriteLine(string.Format("The '{0}' is being activated because the Wizard is '{1}'.", this.GetType().Name, reason.ToString())); }
/// <summary> /// The callback method being executed when the current wizard page is showing. /// </summary> protected internal override Task ExecuteShowAsync(IWizardPage fromPage) { return TaskEmpty; }
#pragma warning disable WPF0005 // Name of PropertyChangedCallback should match registered name. private void UpdatePage() #pragma warning restore WPF0005 // Name of PropertyChangedCallback should match registered name. { if (AssociatedObject is null) { return; } var wizard = Wizard; if (wizard is null) { return; } var lastPage = _lastPage; if (lastPage is not null) { if (ReferenceEquals(lastPage, wizard.CurrentPage)) { // Nothing has really changed return; } _scrollPositions.AddOrUpdate(lastPage, new ScrollInfo { VerticalOffset = _scrollViewer.VerticalOffset, HorizontalOffset = _scrollViewer.HorizontalOffset }); // Even though we cache views, we need to re-use the vm's since the view models will be closed when moving next //_lastPage.ViewModel = null; if (CacheViews) { _cachedViews.AddOrUpdate(lastPage, new CachedView { View = AssociatedObject.Content as IView }); } _lastPage = null; } _lastPage = wizard.CurrentPage; var dependencyResolver = this.GetDependencyResolver(); var viewModelLocator = dependencyResolver.Resolve <IWizardPageViewModelLocator>(); var pageViewModelType = viewModelLocator.ResolveViewModel(_lastPage.GetType()); var viewLocator = dependencyResolver.Resolve <IViewLocator>(); var viewType = viewLocator.ResolveView(pageViewModelType); var typeFactory = dependencyResolver.Resolve <ITypeFactory>(); IView view = null; if (_cachedViews.TryGetValue(_lastPage, out var cachedView)) { view = cachedView.View; } if (view is null) { view = typeFactory.CreateInstance(viewType) as IView; if (view is null) { return; } } // For now always recreate a vm since it could be closed (and we really don't want to mess with the lifetime of a view) //var viewModel = view.DataContext as IViewModel; IViewModel viewModel = null; if (viewModel is null) { var viewModelFactory = dependencyResolver.Resolve <IViewModelFactory>(); viewModel = viewModelFactory.CreateViewModel(pageViewModelType, wizard.CurrentPage, null); view.DataContext = viewModel; } _lastPage.ViewModel = viewModel; AssociatedObject.SetCurrentValue(ContentControl.ContentProperty, view); var verticalScrollViewerOffset = 0d; var horizontalScrollViewerOffset = 0d; if (_scrollPositions.TryGetValue(_lastPage, out var scrollInfo)) { verticalScrollViewerOffset = scrollInfo.VerticalOffset; horizontalScrollViewerOffset = scrollInfo.HorizontalOffset; } var scrollViewer = _scrollViewer; if (scrollViewer is not null && (Wizard?.RestoreScrollPositionPerPage ?? true)) { scrollViewer.ScrollToVerticalOffset(verticalScrollViewerOffset); scrollViewer.ScrollToHorizontalOffset(horizontalScrollViewerOffset); } }