Пример #1
0
        public HelpBox(HelpWorkflow workFlow, string text, string optionIfAny)
        {
            _workFlow = workFlow;
            InitializeComponent();

            if (workFlow == null && text == null && optionIfAny == null)
            {
                text        = "Some useful text which will help guide the user to perform an activity";
                optionIfAny = "Some alternate option button the user can click";
            }

            lblHelp.Text = text;

            btnOption1.Text    = optionIfAny;
            btnOption1.Visible = !string.IsNullOrWhiteSpace(optionIfAny);

            if (string.IsNullOrWhiteSpace(optionIfAny))
            {
                //make label fill whole form
                lblHelp.Height = panel1.Height;
            }

            btnOption1.Click += (s, e) =>
            {
                if (OptionTaken != null)
                {
                    OptionTaken();
                }
            };

            Size = GetSizeOfHelpBoxFor(text, !string.IsNullOrWhiteSpace(optionIfAny));
        }
Пример #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);
        }