Exemplo n.º 1
0
        /// <summary>
        /// Raises the <see cref="UnselectingEvent"/> event.
        /// </summary>
        /// <param name="e">A <see cref="WizardSelectedPageChangeEventArgs"/> that contains the event data.</param>
        protected override void OnUnselecting(WizardSelectedPageChangeEventArgs e)
        {
            // Call the base method
            base.OnUnselecting(e);

            // Get the repeat count
            TextBox repeatCountTextbox = (TextBox)this.FindName("PART_RepeatCountTextBox");

            if (repeatCountTextbox != null)
            {
                int repeatCount;
                if ((int.TryParse(repeatCountTextbox.Text, out repeatCount)) && (repeatCount > 0) && (repeatCount <= 10))
                {
                    // Place an ItemStore in the Wizard's Tag
                    ItemStore store = (ItemStore)this.Wizard.Tag;
                    if ((store == null) || (store.Items.Count != repeatCount))
                    {
                        store = new ItemStore();
                        for (int index = 0; index < repeatCount; index++)
                        {
                            Item item = new Item();
                            item.Index = index + 1;
                            store.Items.Add(item);
                        }
                        this.Wizard.Tag = store;
                    }
                    return;
                }

                MessageBox.Show("Please enter a number between 1 and 10.");
            }

            e.Handled = true;
            e.Cancel  = true;
        }
        /// <summary>
        /// Raises the <see cref="SelectingEvent"/> event.
        /// </summary>
        /// <param name="e">A <see cref="WizardSelectedPageChangeEventArgs"/> that contains the event data.</param>
        protected override void OnUnselecting(WizardSelectedPageChangeEventArgs e)
        {
            // Call the base method
            base.OnUnselecting(e);

            if (!e.Handled)
            {
                bool isForwardProgress  = ((e.SelectionFlags & WizardPageSelectionFlags.ForwardProgress) == WizardPageSelectionFlags.ForwardProgress);
                bool isBackwardProgress = ((e.SelectionFlags & WizardPageSelectionFlags.BackwardProgress) == WizardPageSelectionFlags.BackwardProgress);

                ItemStore store = (ItemStore)this.Wizard.Tag;
                if (
                    ((isForwardProgress) && (store.CurrentIndex < store.Items.Count - 1)) ||
                    ((isBackwardProgress) && (store.CurrentIndex > 0))
                    )
                {
                    // Cancel the page change
                    e.Handled = true;
                    e.Cancel  = true;

                    // Update the current item index and reinit the page
                    store.CurrentIndex = store.CurrentIndex + (isForwardProgress ? 1 : -1);
                    this.InitializePage();
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Occurs after the wizard's selected page has changed.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void wizard_SelectedPageChanged(object sender, WizardSelectedPageChangeEventArgs e)
 {
     if (e.NewSelectedPage == processingPage)
     {
         // Clear the processing amount
         progressBar.Value = 0;
     }
 }
Exemplo n.º 4
0
        /////////////////////////////////////////////////////////////////////////////////////////////////////
        // NON-PUBLIC PROCEDURES
        /////////////////////////////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Occurs after the wizard's selected page has changed.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">Event arguments.</param>
        private void wizard_SelectedPageChanged(object sender, WizardSelectedPageChangeEventArgs e)
        {
            if (e.NewSelectedPage == cancelSelectionChangePage)
            {
                // Update the selection flags TextBlock to indicate what flags were used in selecting this page
                selectionFlagsTextBlock.Text = e.SelectionFlags.ToString();
            }
        }
Exemplo n.º 5
0
 public void CheckActionSetting(ObservableCollection <object> optinalActions, WizardSelectedPageChangeEventArgs e)
 {
     if ((e.SelectionFlags & WizardPageSelectionFlags.BackwardProgress) == WizardPageSelectionFlags.BackwardProgress)
     {
         return;
     }
     e.Cancel = optinalActions.Count == 0;
 }
        /// <summary>
        /// Raises the <see cref="SelectingEvent"/> event.
        /// </summary>
        /// <param name="e">A <see cref="WizardSelectedPageChangeEventArgs"/> that contains the event data.</param>
        protected override void OnSelecting(WizardSelectedPageChangeEventArgs e)
        {
            // Call the base method
            base.OnSelecting(e);

            // Initialize the page
            this.InitializePage();
        }
Exemplo n.º 7
0
 /// <summary>
 /// Occurs before the wizard's selected page has changed.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void wizard_SelectedPageChanging(object sender, WizardSelectedPageChangeEventArgs e)
 {
     if (e.OldSelectedPage == cancelSelectionChangePage)
     {
         // If the cancel selection change CheckBox is checked, cancel the selection change
         if (cancelSelectionChangeCheckBox.IsChecked == true)
         {
             MessageBox.Show("The selected page change is cancelled because you have the CheckBox set.  Clear the CheckBox to be able to navigate through the wizard again.", "Wizard Sample");
             e.Cancel = true;
         }
     }
 }
Exemplo n.º 8
0
 /// <summary>
 /// Occurs after the wizard's selected page has changed.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">Event arguments.</param>
 private void wizard_SelectedPageChanged(object sender, WizardSelectedPageChangeEventArgs e)
 {
     if (e.NewSelectedPage == processingPage)
     {
         // Clear the processing amount
         progressBar.Value = 0;
     }
     if (e.NewSelectedPage == cancelSelectionChangePage)
     {
         // Update the selection flags TextBlock to indicate what flags were used in selecting this page
         selectionFlagsTextBlock.Text = e.SelectionFlags.ToString();
     }
 }
Exemplo n.º 9
0
 public void CheckActionSetting(ObservableCollection<object> optinalActions, WizardSelectedPageChangeEventArgs e)
 {
     if ((e.SelectionFlags & WizardPageSelectionFlags.BackwardProgress) == WizardPageSelectionFlags.BackwardProgress)
         return;
     e.Cancel = optinalActions.Count == 0;
 }