コード例 #1
0
        /// <summary>
        /// Activates a page
        /// </summary>
        /// <param name="wizardPage"></param>
        /// <param name="previousPage"></param>
        /// <param name="location"></param>
        /// <param name="throwExceptions"></param>
        /// <returns></returns>
        public bool ActivatePage(IWizardPage wizardPage, IWizardPage previousPage, WizardNavigationLocation location, WizardNavigationReasons reason, bool throwExceptions)
        {
            if (wizardPage != null)
            {
                try
                {
                    wizardPage.Activate(previousPage, location, reason);

                    // figure out the names of the possible routes away from this location
                    string[] names     = location.Paths.GetPathNames();
                    string   pathNames = string.Join(", ", names);
                    Debug.WriteLine(string.Format("The location represented by the '{0}' WizardPage has '{1}' possible routes.\n\tThey are as follows '{2}' with the page types to which they point.", location.WizardPageType.Name, location.Paths.Count, pathNames));
                    foreach (WizardNavigationPath path in location.Paths)
                    {
                        Debug.WriteLine(string.Format("\t'{0}' = {1}", path.Name, path.Destination.WizardPageType.Name));
                    }

                    return(true);
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(ex);
                    if (throwExceptions)
                    {
                        throw new Exception(ex.Message, ex);
                    }
                }
            }
            return(false);
        }
コード例 #2
0
		/// <summary>
		/// Activates a page
		/// </summary>
		/// <param name="wizardPage"></param>
		/// <param name="previousPage"></param>
		/// <param name="location"></param>
		/// <param name="throwExceptions"></param>
		/// <returns></returns>
		public bool ActivatePage(IWizardPage wizardPage, IWizardPage previousPage, WizardNavigationLocation location, WizardNavigationReasons reason, bool throwExceptions)
		{
			if (wizardPage != null)
			{
				try
				{
					wizardPage.Activate(previousPage, location, reason);

					// figure out the names of the possible routes away from this location
					string[] names = location.Paths.GetPathNames();
					string pathNames = string.Join(", ", names);					
					Debug.WriteLine(string.Format("The location represented by the '{0}' WizardPage has '{1}' possible routes.\n\tThey are as follows '{2}' with the page types to which they point.", location.WizardPageType.Name, location.Paths.Count, pathNames));					
					foreach(WizardNavigationPath path in location.Paths)
						Debug.WriteLine(string.Format("\t'{0}' = {1}", path.Name, path.Destination.WizardPageType.Name));

					return true;
				}
				catch(Exception ex)
				{
					Trace.WriteLine(ex);
					if (throwExceptions)
						throw new Exception(ex.Message, ex);
				}
			}
			return false;
		}