Esempio n. 1
0
        private static void GetAllForms(ref List <Form_WizardBase> _list, Form_WizardBase _entryForm)
        {
            _list.Add(_entryForm);

            if (_entryForm.Next != null)
            {
                WizardManager.GetAllForms(ref _list, _entryForm.Next);
            }
        }
Esempio n. 2
0
        private static T RunForm <T>(Form_WizardBase _form_WizardBase)
        {
            WizardDialogResult _wizardDialogResult = _form_WizardBase.ShowDialog();

            switch (_wizardDialogResult)
            {
            case WizardDialogResult.BACK:
            {
                _form_WizardBase.Previous.StartPosition = FormStartPosition.Manual;
                _form_WizardBase.Previous.Location      = _form_WizardBase.Location;
                _form_WizardBase.Previous.Size          = _form_WizardBase.Size;
                _form_WizardBase.Previous.State         = _form_WizardBase.State;

                //trenutno formo disposamo, ker je lahko vedno druga zaradi različnih opcij
                Form_WizardBase _previous = _form_WizardBase.Previous;
                _form_WizardBase.Dispose();

                return(WizardManager.RunForm <T>(_previous));
            }


            case WizardDialogResult.NEXT:
            {
                _form_WizardBase.Next.StartPosition = FormStartPosition.Manual;
                _form_WizardBase.Next.Location      = _form_WizardBase.Location;
                _form_WizardBase.Next.Size          = _form_WizardBase.Size;
                _form_WizardBase.Next.State         = _form_WizardBase.State;

                //trenutne forme ne smemo disposat, ker jo potrebujemo za Back

                return(WizardManager.RunForm <T>(_form_WizardBase.Next));
            }

            case WizardDialogResult.FINISH:
            {
                _form_WizardBase.Finish.StartPosition = FormStartPosition.Manual;
                _form_WizardBase.Finish.Location      = _form_WizardBase.Location;
                _form_WizardBase.Finish.Size          = _form_WizardBase.Size;
                _form_WizardBase.Finish.State         = _form_WizardBase.State;

                //trenutne forme ne smemo disposat, ker jo potrebujemo za Back

                return(WizardManager.RunForm <T>(_form_WizardBase.Finish));
            }

            case WizardDialogResult.CLOSE:
            {
                return((T)_form_WizardBase.Result);
            }


            default:
            {
                return(default(T));
            }
            }
        }
Esempio n. 3
0
        public static T StartWizard <T>(Form_WizardBase _entryForm)
        {
            if (_entryForm.Previous != null)
            {
                throw new Exception("EntryForm ne sme imet previousa!!!");
            }


            T _t = WizardManager.RunForm <T>(_entryForm);

            #region "Dispose all"
            List <Form_WizardBase> _list = new List <Form_WizardBase>();
            WizardManager.GetAllForms(ref _list, _entryForm);
            foreach (Form_WizardBase _form_WizardBase in _list)
            {
                if (!_entryForm.Disposing)
                {
                    _form_WizardBase.Dispose();
                }
            }
            #endregion "Dispose all"

            return(_t);
        }