Пример #1
0
        ///<summary>
        ///Performs additional custom processes when removing an element from the <see cref="T:System.Collections.CollectionBase"></see> instance.
        ///</summary>
        ///
        ///<param name="value">The value of the element to remove from index.</param>
        ///<param name="index">The zero-based index at which value can be found.</param>
        protected override void OnRemove(int index, object value)
        {
            GenericCancelEventArgs <T> e = new GenericCancelEventArgs <T>((T)value);

            if (Removing != null)
            {
                Removing(index, e);
                if (e.Cancel)
                {
                    return;
                }
            }
            base.OnRemove(index, value);
        }
Пример #2
0
        ///<summary>
        ///Performs additional custom processes when clearing the contents of the <see cref="T:System.Collections.CollectionBase"></see> instance.
        ///</summary>
        ///
        protected override void OnClear()
        {
            GenericCancelEventArgs <GenericCollection <T> > e = new GenericCancelEventArgs <GenericCollection <T> >(this);

            if (Clearing != null)
            {
                Clearing(e);
                if (e.Cancel)
                {
                    return;
                }
            }
            base.OnClear();
        }
Пример #3
0
        protected virtual void OnNextButtonClick(object sender, EventArgs e)
        {
            int num;

            if (DesignMode)
            {
                CurrentStepIndex++;
                return;
            }
            else
            {
                num = 0;
                if (!(WizardSteps[CurrentStepIndex] is StartStep))
                {
                    if ((WizardSteps[CurrentStepIndex] is FinishStep))
                    {
                        num = -1;
                    }
                }
                else
                {
                    num = 1;
                }
            }
            if (NextButtonClick == null)
            {
                bool noFinish = false;
                int  num2     = 0;
                if (!(WizardSteps[CurrentStepIndex + 1] is StartStep))
                {
                    if (!(WizardSteps[CurrentStepIndex + 1] is FinishStep))
                    {
                        noFinish = true;
                    }
                    else
                    {
                        num2 = -1;
                    }
                }
                else
                {
                    num2 = 1;
                }
                if (((indexer + num) + num2) >= 0)
                {
                    if ((((indexer + num) + num2) != 0) || !noFinish)
                    {
                        WizardSteps[CurrentStepIndex + 1].BackStepIndex = CurrentStepIndex;
                        CurrentStepIndex++;
                        indexer += num;
                    }
                }
                else
                {
                    throw new InvalidOperationException("The steps must be well formed, so there cannot be an IntermediateStep without enclosing.");
                }
            }
            else
            {
                GenericCancelEventArgs <WizardControl> args = new GenericCancelEventArgs <WizardControl>(this);
                NextButtonClick(this, args);
                if (args.Cancel)
                {
                    return;
                }
                int nextStep = GetNextStep();
                if (nextStep != -1)
                {
                    WizardSteps[nextStep].BackStepIndex = CurrentStepIndex;
                    CurrentStepIndex = nextStep;
                    indexer         += num;
                    return;
                }
                WizardSteps[CurrentStepIndex + 1].BackStepIndex = CurrentStepIndex;
                CurrentStepIndex++;
                indexer += num;
                return;
            }
        }