当前位置: 首页>>代码示例>>C#>>正文


C# WizardNavigationEventArgs.SetNextStepIndex方法代码示例

本文整理汇总了C#中System.Web.UI.WebControls.WizardNavigationEventArgs.SetNextStepIndex方法的典型用法代码示例。如果您正苦于以下问题:C# WizardNavigationEventArgs.SetNextStepIndex方法的具体用法?C# WizardNavigationEventArgs.SetNextStepIndex怎么用?C# WizardNavigationEventArgs.SetNextStepIndex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.UI.WebControls.WizardNavigationEventArgs的用法示例。


在下文中一共展示了WizardNavigationEventArgs.SetNextStepIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnBubbleEvent

        protected override bool OnBubbleEvent(object source, EventArgs e) {
            bool handled = false;

            CommandEventArgs ce = e as CommandEventArgs;
            if (ce != null) {
                if (String.Equals(CancelCommandName, ce.CommandName, StringComparison.OrdinalIgnoreCase)) {
                    OnCancelButtonClick(EventArgs.Empty);
                    return true;
                }

                int oldIndex = ActiveStepIndex;
                int newIndex = oldIndex;

                // Check if we need to validate the bubble commands VSWhidbey 312445
                bool verifyEvent = true;

                WizardStepType stepType = WizardStepType.Auto;
                WizardStepBase step = WizardSteps[oldIndex];

                // Don't validate commands if it's a templated wizard step
                if (step is TemplatedWizardStep) {
                    verifyEvent = false;
                } else {
                    stepType = GetStepType(step);
                }

                WizardNavigationEventArgs args = new WizardNavigationEventArgs(oldIndex, newIndex);

                // Do not navigate away from current view if view is not valid.
                if (_commandSender != null && Page != null && !Page.IsValid) {
                    args.Cancel = true;
                }

                bool previousButtonCommand = false;
                _activeStepIndexSet = false;

                if (String.Equals(MoveNextCommandName, ce.CommandName, StringComparison.OrdinalIgnoreCase)) {
                    if (verifyEvent) {
                        if (stepType != WizardStepType.Start && stepType != WizardStepType.Step) {
                            throw new InvalidOperationException(SR.GetString(SR.Wizard_InvalidBubbleEvent, MoveNextCommandName));
                        }
                    }

                    if (oldIndex < WizardSteps.Count - 1) {
                        args.SetNextStepIndex(oldIndex + 1);
                    }

                    OnNextButtonClick(args);
                    handled = true;
                } else if (String.Equals(MovePreviousCommandName, ce.CommandName, StringComparison.OrdinalIgnoreCase)) {
                    if (verifyEvent) {
                        if (stepType != WizardStepType.Step && stepType != WizardStepType.Finish) {
                            throw new InvalidOperationException(SR.GetString(SR.Wizard_InvalidBubbleEvent, MovePreviousCommandName));
                        }
                    }

                    previousButtonCommand = true;

                    int previousIndex = GetPreviousStepIndex(false);
                    if (previousIndex != -1) {
                        args.SetNextStepIndex(previousIndex);
                    }

                    OnPreviousButtonClick(args);
                    handled = true;
                } else if (String.Equals(MoveCompleteCommandName, ce.CommandName, StringComparison.OrdinalIgnoreCase)) {
                    if (verifyEvent) {
                        if (stepType != WizardStepType.Finish) {
                            throw new InvalidOperationException(SR.GetString(SR.Wizard_InvalidBubbleEvent, MoveCompleteCommandName));
                        }
                    }

                    if (oldIndex < WizardSteps.Count - 1) {
                        args.SetNextStepIndex(oldIndex + 1);
                    }

                    OnFinishButtonClick(args);
                    handled = true;
                } else if (String.Equals(MoveToCommandName, ce.CommandName, StringComparison.OrdinalIgnoreCase)) {
                    newIndex = Int32.Parse((String)ce.CommandArgument, CultureInfo.InvariantCulture);
                    args.SetNextStepIndex(newIndex);

                    handled = true;
                }

                if (handled) {
                    if (!args.Cancel) {
                        // Honor user's change if activeStepIndex is set explicitely;
                        if (!_activeStepIndexSet) {
                            // Make sure the next step is valid to navigate to
                            if (AllowNavigationToStep(args.NextStepIndex)) {
                                if (previousButtonCommand) {
                                    GetPreviousStepIndex(true);
                                }

                                ActiveStepIndex = args.NextStepIndex;
                            }
                        }
                    } else {
                        // revert active step if it's cancelled.
//.........这里部分代码省略.........
开发者ID:uQr,项目名称:referencesource,代码行数:101,代码来源:Wizard.cs

示例2: OnBubbleEvent

 protected override bool OnBubbleEvent(object source, EventArgs e)
 {
     bool flag = false;
     CommandEventArgs args = e as CommandEventArgs;
     if (args != null)
     {
         if (string.Equals(CancelCommandName, args.CommandName, StringComparison.OrdinalIgnoreCase))
         {
             this.OnCancelButtonClick(EventArgs.Empty);
             return true;
         }
         int activeStepIndex = this.ActiveStepIndex;
         int nextStepIndex = activeStepIndex;
         bool flag2 = true;
         WizardStepType auto = WizardStepType.Auto;
         WizardStepBase step = this.WizardSteps[activeStepIndex];
         if (step is TemplatedWizardStep)
         {
             flag2 = false;
         }
         else
         {
             auto = this.GetStepType(step);
         }
         WizardNavigationEventArgs args2 = new WizardNavigationEventArgs(activeStepIndex, nextStepIndex);
         if (((this._commandSender != null) && (this.Page != null)) && !this.Page.IsValid)
         {
             args2.Cancel = true;
         }
         bool flag3 = false;
         this._activeStepIndexSet = false;
         if (string.Equals(MoveNextCommandName, args.CommandName, StringComparison.OrdinalIgnoreCase))
         {
             if ((flag2 && (auto != WizardStepType.Start)) && (auto != WizardStepType.Step))
             {
                 throw new InvalidOperationException(System.Web.SR.GetString("Wizard_InvalidBubbleEvent", new object[] { MoveNextCommandName }));
             }
             if (activeStepIndex < (this.WizardSteps.Count - 1))
             {
                 args2.SetNextStepIndex(activeStepIndex + 1);
             }
             this.OnNextButtonClick(args2);
             flag = true;
         }
         else if (string.Equals(MovePreviousCommandName, args.CommandName, StringComparison.OrdinalIgnoreCase))
         {
             if ((flag2 && (auto != WizardStepType.Step)) && (auto != WizardStepType.Finish))
             {
                 throw new InvalidOperationException(System.Web.SR.GetString("Wizard_InvalidBubbleEvent", new object[] { MovePreviousCommandName }));
             }
             flag3 = true;
             int previousStepIndex = this.GetPreviousStepIndex(false);
             if (previousStepIndex != -1)
             {
                 args2.SetNextStepIndex(previousStepIndex);
             }
             this.OnPreviousButtonClick(args2);
             flag = true;
         }
         else if (string.Equals(MoveCompleteCommandName, args.CommandName, StringComparison.OrdinalIgnoreCase))
         {
             if (flag2 && (auto != WizardStepType.Finish))
             {
                 throw new InvalidOperationException(System.Web.SR.GetString("Wizard_InvalidBubbleEvent", new object[] { MoveCompleteCommandName }));
             }
             if (activeStepIndex < (this.WizardSteps.Count - 1))
             {
                 args2.SetNextStepIndex(activeStepIndex + 1);
             }
             this.OnFinishButtonClick(args2);
             flag = true;
         }
         else if (string.Equals(MoveToCommandName, args.CommandName, StringComparison.OrdinalIgnoreCase))
         {
             nextStepIndex = int.Parse((string) args.CommandArgument, CultureInfo.InvariantCulture);
             args2.SetNextStepIndex(nextStepIndex);
             flag = true;
         }
         if (flag)
         {
             if (!args2.Cancel)
             {
                 if (!this._activeStepIndexSet && this.AllowNavigationToStep(args2.NextStepIndex))
                 {
                     if (flag3)
                     {
                         this.GetPreviousStepIndex(true);
                     }
                     this.ActiveStepIndex = args2.NextStepIndex;
                 }
                 return flag;
             }
             this.ActiveStepIndex = activeStepIndex;
         }
     }
     return flag;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:97,代码来源:Wizard.cs


注:本文中的System.Web.UI.WebControls.WizardNavigationEventArgs.SetNextStepIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。