Esempio n. 1
0
        public async Task NavigateAsync(PageId id)
        {
            Page newPage;
            if (!Pages.ContainsKey(id))
            {

                switch (id)
                {


                    case PageId.Home:
                        Pages.Add(id, new BizDeducterNavigationPage(new HomePage()));
                        break;
					case PageId.TaxCalendar:
						Pages.Add(id, new BizDeducterNavigationPage(new TaxCalendarPage()));
						break;
					case PageId.TaxBracket:
						Pages.Add(id, new BizDeducterNavigationPage(new TaxBracketPage()));
						break;

                }
            }

            newPage = Pages[id];
            if(newPage == null)
                return;

            //pop to root for Windows Phone
            if (Detail != null && Device.OS == TargetPlatform.WinPhone)
            {
                await Detail.Navigation.PopToRootAsync();
            }

            Detail = newPage;

            if(Device.Idiom != TargetIdiom.Tablet)
                IsPresented = false;
        }
Esempio n. 2
0
 public static string GetPageId(PageId id)
 {
     return fileMap[id];
 }
Esempio n. 3
0
        public static void RoundDisplay(PageId type, string title, IEnumerable<Round> rounds)
        {
            if (type != PageId.RoundFull && type != PageId.RoundPartial)
                throw new ArgumentException("invalid PageId");

            Template t = velocity.GetTemplate(@"templates\round_display.vm");
            VelocityContext c = new VelocityContext(baseContext);
            c.Put("rounds", rounds);
            c.Put("title", title);
            StringWriter sw = new StringWriter();
            t.Merge(c, sw);

            string fileName = fileMap[type];
            File.WriteAllText("html\\" + fileName, sw.ToString());
        }
Esempio n. 4
0
		/// <summary>
		/// Redirects the user to the specified <paramref name="page"/> and with the specified 
		/// <paramref name="args"/> appended as query string parameters. Example: If <paramref name="page"/> is PageId.album, 
		/// the current page is /dev/gs/gallery.aspx, <paramref name="format"/> is "aid={0}", and <paramref name="args"/>
		/// is "23", this function redirects to /dev/gs/gallery.aspx?g=album&amp;aid=23.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		/// <param name="endResponse">When <c>true</c> the redirect occurs immediately. When false, the redirect is delayed until the
		/// page processing is complete.</param>
		/// <param name="format">A format string whose placeholders are replaced by values in <paramref name="args"/>. Do not use a '?'
		/// or '&amp;' at the beginning of the format string. Example: "msg={0}".</param>
		/// <param name="args">The values to be inserted into the <paramref name="format"/> string.</param>
		public static void Redirect(PageId page, bool endResponse, string format, params object[] args)
		{
			HttpContext.Current.Response.Redirect(GetUrl(page, format, args), endResponse);
			HttpContext.Current.ApplicationInstance.CompleteRequest();
		}
Esempio n. 5
0
		/// <summary>
		/// Transfers the user, using Server.Transfer, to the specified <paramref name="page"/>.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		public static void Transfer(PageId page)
		{
			try
			{
				HttpContext.Current.Server.Transfer(GetUrl(page));
			}
			catch (System.Threading.ThreadAbortException) { }
		}
Esempio n. 6
0
		/// <summary>
		/// Redirects the user, using Response.Redirect, to the specified <paramref name="page"/> and with the specified 
		/// <paramref name="args"/> appended as query string parameters. Example: If <paramref name="page"/> is PageId.album, 
		/// the current page is /dev/gs/gallery.aspx, <paramref name="format"/> is "aid={0}", and <paramref name="args"/>
		/// is "23", this function redirects to /dev/gs/gallery.aspx?g=album&amp;aid=23.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		/// <param name="format">A format string whose placeholders are replaced by values in <paramref name="args"/>. Do not use a '?'
		/// or '&amp;' at the beginning of the format string. Example: "msg={0}".</param>
		/// <param name="args">The values to be inserted into the <paramref name="format"/> string.</param>
		public static void Redirect(PageId page, string format, params object[] args)
		{
			HttpContext.Current.Response.Redirect(GetUrl(page, format, args), true);
		}
Esempio n. 7
0
		/// <summary>
		/// Redirects the user, using Response.Redirect, to the specified <paramref name="page"/>. If <paramref name="endResponse"/> is true, the redirect occurs 
		/// when the page has finished processing all events. When false, the redirect occurs immediately.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		/// <param name="endResponse">When <c>true</c> the redirect occurs immediately. When false, the redirect is delayed until the
		/// page processing is complete.</param>
		public static void Redirect(PageId page, bool endResponse)
		{
			HttpContext.Current.Response.Redirect(GetUrl(page), endResponse);
		}
Esempio n. 8
0
		/// <summary>
		/// Get an URL relative to the application root for the requested <paramref name="page"/> and with the specified 
		/// <paramref name="args"/> appended as query string parameters. Example: If <paramref name="page"/> is PageId.task_addobjects, 
		/// the current page is /dev/gs/gallery.aspx, <paramref name="format"/> is "aid={0}", and <paramref name="args"/>
		/// is "23", this function returns /dev/gs/gallery.aspx?g=task_addobjects&amp;aid=23. If the <paramref name="page"/> is
		/// <see cref="PageId.album"/> or <see cref="PageId.mediaobject"/>, don't include the "g" query string parameter, since 
		/// we can deduce it by looking for the aid or moid query string parms.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		/// <param name="format">A format string whose placeholders are replaced by values in <paramref name="args"/>. Do not use a '?'
		/// or '&amp;' at the beginning of the format string. Example: "msg={0}".</param>
		/// <param name="args">The values to be inserted into the <paramref name="format"/> string.</param>
		/// <returns>Returns an URL relative to the application root for the requested <paramref name="page"/></returns>
		public static string GetUrl(PageId page, string format, params object[] args)
		{
			if ((page == PageId.album) || (page == PageId.mediaobject))
			{
				// Don't use the "g" parameter for album or mediaobject pages, since we can deduce it by looking for the 
				// aid or moid query string parms. This results in a shorter, cleaner URL.
				return Util.UrlBuilder.BuildUrl(string.Format(format, args));
			}
			else
				return Util.UrlBuilder.BuildUrl(String.Concat("g=", page, "&", string.Format(format, args)));
		}
Esempio n. 9
0
		/// <overloads>Get an URL relative to the application root for the requested page.</overloads>
		/// <summary>
		/// Get an URL relative to the application root for the requested <paramref name="page"/>. Example: If 
		/// <paramref name="page"/> is PageId.album and the current page is /dev/gs/gallery.aspx, this function 
		/// returns /dev/gs/gallery.aspx?g=album.
		/// </summary>
		/// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
		/// <returns>Returns an URL relative to the application root for the requested <paramref name="page"/>.</returns>
		public static string GetUrl(PageId page)
		{
			return Util.UrlBuilder.BuildUrl(String.Concat("g=", page));
		}
Esempio n. 10
0
        /// <summary>
        /// Verify the user control we created is the right one, correcting it if necessary. When our initial guess proves correct, this function
        /// returns the same instance that is passed in. If required, replace the <paramref name="galleryControl" /> parameter with the correct one, 
        /// and return its base <see cref="Control" /> class.
        /// </summary>
        /// <param name="galleryControl">The gallery control to validate.</param>
        /// <param name="page">The requested page as determined by an analysis of the query string.</param>
        /// <returns>Returns a <see cref="Control" /> that is correct for the current configuration. May be the same control that is passed in.</returns>
        /// <remarks>We initially determined which page to load by looking at the query string, but the developer may have overridden this by setting
        /// various properties on this control. For example, she may have specified a media object on the <see cref="Gallery.MediaObjectId" /> property, 
        /// or she may have also specified a <see cref="Gallery.AlbumId" /> combined with <see cref="Gallery.ViewMode" /> = Single or SingleRandom, in
        /// which case we need to display a particular media object rather than album thumbnails. If this situation is detected, replace the 
        /// <paramref name="galleryControl" /> parameter with the correct one, and return its base <see cref="Control" /> class. If you are wondering 
        /// why we didn't just determine the right page the first time, that is because we can't invoke <see cref="GalleryPage.GetMediaObjectId" /> until 
        /// after <see cref="GalleryController.InitializeGspApplication" /> fires, which won't happen until after a user control has been loaded. So we make our best guess
        /// by looking at the query string and correcting it here if necessary. Our initial guess should be right more than 99% of the time.</remarks>
        private Control ValidateRequestedPage(GalleryPage galleryControl, PageId page)
        {
            Control control = galleryControl;

              if ((page == PageId.album) && (galleryControl.GetMediaObjectId() > int.MinValue))
              {
            // We need to render in single media object mode (pages/media.ascx).
            control = ConfigureMediaObjectControl();
              }

              if ((page == PageId.mediaobject) && (AllowUrlOverride == false) && (AlbumId > int.MinValue) && (ViewMode == ViewMode.Multiple))
              {
            // We need to render in album thumbnail mode (pages/album.ascx).
            control = ConfigureAlbumThumbnailControl();
              }

              return control;
        }
Esempio n. 11
0
        private static string GetUserControlPath(PageId page)
        {
            string src;

              if (page == PageId.album || page == PageId.mediaobject)
            src = String.Concat(Utils.GalleryRoot, "/pages/media.ascx");
              else
            src = String.Concat(Utils.GalleryRoot, "/pages/", page, ".ascx");

              if (src.IndexOf("/admin_", StringComparison.Ordinal) >= 0)
            src = src.Replace("/admin_", "/admin/");
              if (src.IndexOf("/error", StringComparison.Ordinal) >= 0)
            src = src.Replace("/error_", "/error/");
              if (src.IndexOf("/task_", StringComparison.Ordinal) >= 0)
            src = src.Replace("/task_", "/task/");

              return src;
        }
        /// <summary>
        /// Get an absolute URL for the requested page (eg. "http://site.com/gallery/default.aspx?moid=283").
        /// This works similar to <see cref="Utils.GetUrl(PageId, string, object[])" /> except this has no 
        /// dependence on <see cref="HttpContext.Current" /> and it returns an absolute URL instead of a relative one.
        /// </summary>
        /// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="Pages.GalleryPage"/>.</param>
        /// <param name="format">A format string whose placeholders are replaced by values in <paramref name="args"/>. Do not use a '?'
        /// or '&amp;' at the beginning of the format string. Example: "msg={0}".</param>
        /// <param name="args">The values to be inserted into the <paramref name="format"/> string.</param>
        /// <returns>Returns an absolute URL for the requested <paramref name="page"/>.</returns>
        private string GetPageUrl(PageId page, string format, params object[] args)
        {
            var queryString = String.Format(CultureInfo.InvariantCulture, format, args);

            if ((page != PageId.album) && (page != PageId.mediaobject))
            {
                // Don't use the "g" parameter for album or mediaobject pages, since we can deduce it by looking for the
                // aid or moid query string parms. This results in a shorter, cleaner URL.
                queryString = String.Concat("g=", page, "&", queryString);
            }

            return Utils.AddQueryStringParameter(String.Concat(HostUrl, DestinationPageUrl), queryString);
        }
Esempio n. 13
0
 /// <overloads>Get an URL relative to the application root for the requested page.</overloads>
 /// <summary>
 /// Get an URL relative to the application root for the requested <paramref name="page"/>. Example: If 
 /// <paramref name="page"/> is PageId.album and the current page is /dev/gs/gallery.aspx, this function 
 /// returns /dev/gs/gallery.aspx?g=album.
 /// </summary>
 /// <param name="page">A <see cref="PageId"/> enumeration that represents the desired <see cref="GalleryPage"/>.</param>
 /// <returns>Returns an URL relative to the application root for the requested <paramref name="page"/>.</returns>
 public static string GetUrl(PageId page)
 {
     return AddQueryStringParameter(Utils.GetCurrentPageUrl(), String.Concat("g=", page));
 }
Esempio n. 14
0
 /// <summary>
 /// Gets the URL to the requested page.
 /// </summary>
 /// <param name="page">The page.</param>
 /// <returns>System.String.</returns>
 private string GetAdminUrl(PageId page)
 {
     if (MediaObjectId > int.MinValue)
     {
         return Utils.GetUrl(page, "moid={0}", MediaObjectId);
     }
     else
     {
         return Utils.GetUrl(page, "aid={0}", AlbumId);
     }
 }
Esempio n. 15
0
 public override string ToString()
 {
     return("PageId = " + PageId.ToString() + ",PageTitle = " + PageTitle + ",PageName = " + PageName + ",Description = " + Description + ",PageUrl = " + PageUrl + ",ImageUrl = " + ImageUrl + ",ModuleId = " + ModuleId.ToString() + ",IsPage = " + IsPage.ToString() + ",IsRemoved = " + IsRemoved.ToString() + ",CreateDate = " + CreateDate.ToString() + ",CreatorId = " + CreatorId.ToString());
 }