Esempio n. 1
0
 private void HandleParams(HelpStage[] nextStagesInOrder)
 {
     for (int i = 0; i < nextStagesInOrder.Length; i++)
     {
         if (i == 0)
         {
             Next = nextStagesInOrder[i];
         }
         else
         {
             nextStagesInOrder[i - 1].Next = nextStagesInOrder[i];
         }
     }
 }
Esempio n. 2
0
        public HelpBox ShowStage(HelpWorkflow workflow, HelpStage stage)
        {
            if (_currentHelpBox != null)
            {
                _host.Controls.Remove(_currentHelpBox);
            }

            _highlight      = stage.HighlightControl;
            _currentHelpBox = new HelpBox(workflow, stage.HelpText, stage.OptionButtonText);

            _currentHelpBox.Location = stage.UseDefaultPosition ? GetGoodLocationForHelpBox(_currentHelpBox) : stage.HostLocationForStageBox;

            _host.Controls.Add(_currentHelpBox);
            _currentHelpBox.BringToFront();
            _host.Invalidate();
            return(_currentHelpBox);
        }
Esempio n. 3
0
        public void ShowStage(HelpStage stage)
        {
            //Abandon must have already been called
            if (_help == null)
            {
                return;
            }

            if (HostControl.InvokeRequired)
            {
                HostControl.Invoke(new MethodInvoker(() => ShowStage(stage)));
                return;
            }

            CurrentStage = stage;

            var helpBox = _help.ShowStage(this, CurrentStage);

            helpBox.OptionTaken += () => ShowStage(CurrentStage.OptionDestination);

            var t = stage.Await(_cancellationTokenSource.Token);

            t.ContinueWith(r =>
            {
                if (r.IsFaulted || r.IsCanceled)
                {
                    Abandon();
                }
                else
                {
                    try
                    {
                        if (r.Result)
                        {
                            ShowNextStageOrClose();
                        }
                    }
                    catch (Exception)
                    {
                        Abandon();
                    }
                }
            });
        }
Esempio n. 4
0
 public HelpStage SetNext(HelpStage next)
 {
     Next = next;
     return(next);
 }
Esempio n. 5
0
 public void SetOption(string optionButtonText, HelpStage destinationWhenOptionTaken)
 {
     OptionButtonText  = optionButtonText;
     OptionDestination = destinationWhenOptionTaken;
 }