Пример #1
0
        /// <summary>
        /// Show the Next Step
        /// </summary>
        internal void Next()
        {
            IWizardForm now = prevsteps.Tail();

            if (now == null)
            {
                return;
            }

            if (now.GetType().GetInterface("IWizardFinish", false) == typeof(IWizardFinish))
            {
                IWizardFinish wf = (IWizardFinish)now;
                wf.Finit();

                prevsteps = new Stack();
                prevsteps.Push(step1);
                ShowStep(step1, true);
            }
            else
            {
                now.WizardWindow.Visible = false;

                now = now.Next;
                if (now == null)
                {
                    return;
                }

                prevsteps.Push(now);
                ShowStep(now, true);
            }
        }
Пример #2
0
        public WizardHandler(IWizardControl[] pages)
        {
            m_form = new Dialog();
            m_form.Title = Strings.WizardHandler.WizardFormTitle;

            #if DEBUG
            m_form.Title += " (DEBUG)";
            #endif

            m_form.Pages.Clear();

            if (pages == null || pages.Length == 0)
            {
                long count = 0;
                lock (Program.MainLock)
                    count = Program.DataConnection.GetObjects<Schedule>().Length;

                if (count == 0)
                    m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.FirstLaunch() });
                else
                    m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.MainPage() });
            }
            else
                m_form.Pages.AddRange(pages);

            m_form.DefaultImage = Properties.Resources.Duplicati;
            m_form.Dialog.Icon = Properties.Resources.TrayNormal;
            m_form.Finished += new System.ComponentModel.CancelEventHandler(m_form_Finished);
        }
Пример #3
0
        public WizardHandler(IWizardControl[] pages)
        {
            m_form       = new Dialog();
            m_form.Title = "HMB v" + System.Reflection.Assembly.GetEntryAssembly().GetName().Version.ToString() + " - Setup Wizard";//Strings.WizardHandler.WizardFormTitle;

#if DEBUG
            m_form.Title += " (DEBUG)";
#endif

            m_form.Pages.Clear();

            if (pages == null || pages.Length == 0)
            {
                long count = 0;
                lock (Program.MainLock)
                    count = Program.DataConnection.GetObjects <Schedule>().Length;

                if (count == 0)
                {
                    m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.FirstLaunch() });
                }
                else
                {
                    m_form.Pages.AddRange(new IWizardControl[] { new Wizard_pages.MainPage() });
                }
            }
            else
            {
                m_form.Pages.AddRange(pages);
            }

            m_form.DefaultImage = Properties.Resources.HMB;
            m_form.Dialog.Icon  = Properties.Resources.TrayNormal;
            m_form.Finished    += new System.ComponentModel.CancelEventHandler(m_form_Finished);
        }
Пример #4
0
        private void StartWizard(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel ll = (LinkLabel)sender;

            wizard = (IWizardForm)ll.Tag;

            Form1.form1.Next();
        }
Пример #5
0
 /// <summary>
 /// Called upon changes in a Step Form
 /// </summary>
 /// <param name="sender">the current Wizard Step</param>
 /// <param name="autonext">true if the page wanted to go to the next Wizard Step NOW</param>
 void ContentChanged(IWizardForm sender, bool autonext)
 {
     llnext.Enabled = sender.CanContinue;
     if (autonext)
     {
         this.Next();
     }
 }
Пример #6
0
        /// <summary>
        /// Remove the last Stack Item
        /// </summary>
        /// <returns>The Removed item</returns>
        /// <remarks>Returns null if the stack was empty</remarks>
        public IWizardForm Pop()
        {
            if (!IsEmpty)
            {
                IWizardForm wf = Tail();
                stack.Remove(wf);
                return(wf);
            }

            return(null);
        }
Пример #7
0
        /// <summary>
        /// Display a new Step
        /// </summary>
        /// <param name="step">The Step you want to Show</param>
        void ShowStep(IWizardForm step, bool init)
        {
            Panel pn = step.WizardWindow;

            //this.Height = pn.Height + 320;

            pn.Visible   = false;
            pn.Parent    = this.pndrop;
            pn.Dock      = DockStyle.None;
            pn.Anchor    = ((System.Windows.Forms.AnchorStyles)(AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Bottom));
            pn.BackColor = Color.White;
            pn.Left      = 16;
            pn.Top       = 0;
            pn.Width     = pndrop.Width - 2 * pn.Left;
            pn.Height    = pndrop.Height - (pn.Top + llnext.Height);

            lbmsg.Text  = step.WizardMessage;
            lbstep.Text = step.WizardStep.ToString();
            //lbmsg.Left = lbstep.Left - lbmsg.Width;
            lbmsg.Width = lbstep.Left - lbmsg.Left + 2;

            llback.Enabled = (prevsteps.Count > 1);
            if (step.GetType().GetInterface("IWizardFinish", false) == typeof(IWizardFinish))
            {
                llnext.Text    = "Finish";
                llnext.Enabled = true;
            }
            else
            {
                llnext.Text    = "Next >";
                llnext.Enabled = (step.Next != null);
            }

            llnext.Enabled = llnext.Enabled & step.CanContinue;
            llopt.Visible  = (prevsteps.Count <= 1);

            bool show = true;

            if (init)
            {
                show = step.Init(new ChangedContent(this.ContentChanged));
            }
            pn.Visible = show;

            lbmsg.SendToBack();
            lbstep.SendToBack();
            pbtop.SendToBack();
            pbstretch.SendToBack();
        }
Пример #8
0
        /// <summary>
        /// Show the Prev Step
        /// </summary>
        internal void Prev()
        {
            IWizardForm now = prevsteps.Pop();

            if (now == null)
            {
                return;
            }
            now.WizardWindow.Visible = false;

            now = prevsteps.Tail();
            if (now == null)
            {
                return;
            }

            ShowStep(now, false);
        }
Пример #9
0
        /// <summary>
        /// Determines if the project item should be added.
        /// </summary>
        /// <remarks>
        /// This is called once per file in the item template (i.e. twice). The flag
        /// indicating the first call is reset after the item file name has been captured.
        /// </remarks>
        /// <param name="filePath">The file to be added.</param>
        /// <returns>True if the file can be added, false otherwise.</returns>
        public bool ShouldAddProjectItem(string filePath)
        {
            bool ans;

            if (this.firstCall)
            {
                WizardData wizardData = null;
                try
                {
                    using (IWizardForm wizard = this.formFactory())
                    {
                        wizard.WizardCompleting += new EventHandler <CancellableWizardEventArgs>(this.WizardCompletingHandler);
                        ans        = wizard.RunWizard();
                        wizardData = wizard.WizardData;
                    }
                }
                catch (Exception ex)
                {
                    this.errorDisplay(ex.Message);
                    throw;
                }
                finally
                {
                    // Handle cancellation
                    if (wizardData != null && !string.IsNullOrEmpty(wizardData.TraceFile) && wizardData.TraceFileSource == TraceFileSource.Dynamic)
                    {
                        File.Delete(wizardData.TraceFile);
                    }
                }
            }
            else
            {
                ans = true;
            }

            if (!ans)
            {
                throw new WizardCancelledException();
            }

            return(ans);
        }
        void InitTemplateUI(object[] customParams)
        {
            selectedTemplate = IdentifyTemplateType(customParams);

            // Display a form to the user to gather their project requirements
            if (selectedTemplate.VSTemplateFileName == "AuMVCTSWP.vstemplate")
            {
                inputForm = new AuVSTemplateForm();
                inputForm.SelectedTemplateItem = selectedTemplate;
                inputForm.BindForm();
                ((Form)inputForm).ShowDialog();
            }

            if (selectedTemplate.VSTemplateFileName == "AuMVCBLWP.vstemplate")
            {
                inputForm = new AuVSTemplateForm();
                inputForm.SelectedTemplateItem = selectedTemplate;
                inputForm.BindForm();
                ((Form)inputForm).ShowDialog();
            }
        }
Пример #11
0
 void IWizardControl.Leave(IWizardForm owner, PageChangedArgs args)
 {
 }
Пример #12
0
 void IWizardControl.Enter(IWizardForm owner, PageChangedArgs args)
 {
 }
Пример #13
0
 void IWizardControl.Display(IWizardForm owner, PageChangedArgs args)
 {
 }
Пример #14
0
        void IWizardControl.Enter(IWizardForm owner, PageChangedArgs args)
        {
            m_owner = args.Owner;
            m_settings = args.Settings;

            if (m_autoFillValues)
                m_valuesAutoLoaded = LoadDialogSettings();

            if (PageEnter != null)
                PageEnter(owner, args);
        }
Пример #15
0
        void IWizardControl.Leave(IWizardForm owner, PageChangedArgs args)
        {
            if (PageLeave != null)
                PageLeave(owner, args);

            if (m_autoFillValues)
                SaveDialogSettings();
        }
Пример #16
0
 /// <summary>
 /// Add a new Object to the Stack
 /// </summary>
 /// <param name="obj">The Object you yant to put on the Stack</param>
 public void Push(IWizardForm obj)
 {
     stack.Add(obj);
 }
Пример #17
0
 void IWizardControl.Display(IWizardForm owner, PageChangedArgs args)
 {
     if (PageDisplay != null)
         PageDisplay(owner, args);
 }
Пример #18
0
 public PageChangedArgs(IWizardForm owner, bool treatAsLast, PageChangedDirection direction)
     : base()
 {
     this.Owner = owner;
     this.Settings = owner.Settings;
     this.Direction = direction;
     this.TreatAsLast = treatAsLast;
 }