internal void RefreshAuthCookie(SystemUserSession Session) { Cookie cookie = GetSignInCookie(); if (cookie == null) { return; } Db.Transact(() => { Session.Token = SystemUser.RenewAuthToken(Session.Token); if (Session.Token.IsPersistent) { Session.Token.Expires = DateTime.UtcNow.AddDays(RememberMeDays); } }); cookie.Value = Session.Token.Token; if (Session.Token.IsPersistent) { cookie.Expires = Session.Token.Expires; } Handle.AddOutgoingCookie(cookie.Name, cookie.GetFullValueString()); }
internal void SetAuthCookie(SystemUserTokenKey token) { var cookie = new Cookie() { Name = AuthCookieName }; if (token == null) { DeleteCookie(cookie); } else { cookie.Value = token.Token; if (token.IsPersistent) { cookie.Expires = token.Expires; } } Handle.AddOutgoingCookie(cookie.Name, cookie.GetFullValueString()); }
protected void SetAuthCookie(SystemUserTokenKey token) { Cookie cookie = new Cookie() { Name = AuthCookieName }; if (token == null) { //to delete a cookie, explicitly use a date in the past cookie.Expires = DateTime.Now.AddDays(-1).ToUniversalTime(); } else { cookie.Value = token.Token; if (token.IsPersistent) { cookie.Expires = token.Expires; } } Handle.AddOutgoingCookie(cookie.Name, cookie.GetFullValueString()); }
static void Main() { var app = Application.Current; app.Use(new HtmlFromJsonProvider()); app.Use(new PartialToStandaloneHtmlProvider()); DummyData.Create(); Handle.GET("/KitchenSink/json", () => { return(new Json()); }); Handle.GET("/KitchenSink/partial/mainpage", () => new MainPage()); Handle.GET("/KitchenSink/mainpage", () => WrapPage <MainPage>("/KitchenSink/partial/mainpage")); Handle.GET("/KitchenSink", () => { return(Self.GET("/KitchenSink/mainpage")); }); Handle.GET("/KitchenSink/partial/button", () => new ButtonPage()); Handle.GET("/KitchenSink/button", () => WrapPage <ButtonPage>("/KitchenSink/partial/button")); Handle.GET("/KitchenSink/partial/breadcrumb", () => { return(Db.Scope(() => { return new BreadcrumbPage(); })); }); Handle.GET("/KitchenSink/breadcrumb", () => WrapPage <BreadcrumbPage>("/KitchenSink/partial/breadcrumb")); Handle.GET("/KitchenSink/partial/chart", () => new ChartPage()); Handle.GET("/KitchenSink/chart", () => WrapPage <ChartPage>("/KitchenSink/partial/chart")); Handle.GET("/KitchenSink/partial/checkbox", () => new CheckboxPage()); Handle.GET("/KitchenSink/checkbox", () => WrapPage <CheckboxPage>("/KitchenSink/partial/checkbox")); Handle.GET("/KitchenSink/partial/togglebutton", () => new ToggleButtonPage()); Handle.GET("/KitchenSink/togglebutton", () => WrapPage <ToggleButtonPage>("/KitchenSink/partial/togglebutton")); Handle.GET("/KitchenSink/partial/datagrid", () => new DatagridPage()); Handle.GET("/KitchenSink/datagrid", () => WrapPage <DatagridPage>("/KitchenSink/partial/datagrid")); Handle.GET("/KitchenSink/partial/decimal", () => new DecimalPage()); Handle.GET("/KitchenSink/decimal", () => WrapPage <DecimalPage>("/KitchenSink/partial/decimal")); Handle.GET("/KitchenSink/partial/dropdown", () => new DropdownPage()); Handle.GET("/KitchenSink/dropdown", () => WrapPage <DropdownPage>("/KitchenSink/partial/dropdown")); Handle.GET("/KitchenSink/partial/html", () => new HtmlPage()); Handle.GET("/KitchenSink/html", () => WrapPage <HtmlPage>("/KitchenSink/partial/html")); Handle.GET("/KitchenSink/partial/integer", () => new IntegerPage()); Handle.GET("/KitchenSink/integer", () => WrapPage <IntegerPage>("/KitchenSink/partial/integer")); Handle.GET("/KitchenSink/partial/Geo", () => { return(Db.Scope(() => { var geoPage = new GeoPage(); geoPage.Init(); return geoPage; })); }); Handle.GET("/KitchenSink/Geo", () => WrapPage <GeoPage>("/KitchenSink/partial/Geo")); Handle.GET("/KitchenSink/partial/markdown", () => new MarkdownPage()); Handle.GET("/KitchenSink/markdown", () => WrapPage <MarkdownPage>("/KitchenSink/partial/markdown")); Handle.GET("/KitchenSink/partial/nested", () => new NestedPartial { Data = new AnyData() }); Handle.GET("/KitchenSink/nested", () => WrapPage <NestedPartial>("/KitchenSink/partial/nested")); Handle.GET("/KitchenSink/partial/radiolist", () => new RadiolistPage()); Handle.GET("/KitchenSink/radiolist", () => WrapPage <RadiolistPage>("/KitchenSink/partial/radiolist")); Handle.GET("/KitchenSink/partial/multiselect", () => new MultiselectPage()); Handle.GET("/KitchenSink/multiselect", () => WrapPage <MultiselectPage>("/KitchenSink/partial/multiselect")); Handle.GET("/KitchenSink/partial/password", () => new PasswordPage()); Handle.GET("/KitchenSink/password", () => WrapPage <PasswordPage>("/KitchenSink/partial/password")); Handle.GET("/KitchenSink/partial/table", () => new TablePage()); Handle.GET("/KitchenSink/table", () => WrapPage <TablePage>("/KitchenSink/partial/table")); Handle.GET("/KitchenSink/partial/text", () => new TextPage()); Handle.GET("/KitchenSink/text", () => WrapPage <TextPage>("/KitchenSink/partial/text")); Handle.GET("/KitchenSink/partial/textarea", () => new TextareaPage()); Handle.GET("/KitchenSink/textarea", () => WrapPage <TextareaPage>("/KitchenSink/partial/textarea")); Handle.GET("/KitchenSink/partial/radio", () => new RadioPage()); Handle.GET("/KitchenSink/radio", () => WrapPage <RadioPage>("/KitchenSink/partial/radio")); Handle.GET("/KitchenSink/partial/Redirect", () => new RedirectPage()); Handle.GET("/KitchenSink/Redirect", () => WrapPage <RedirectPage>("/KitchenSink/partial/Redirect")); Handle.GET("/KitchenSink/partial/Validation", () => new ValidationPage()); Handle.GET("/KitchenSink/Validation", () => WrapPage <ValidationPage>("/KitchenSink/partial/Validation")); Handle.GET("/KitchenSink/Redirect/{?}", (string param) => { var master = WrapPage <RedirectPage>("/KitchenSink/partial/Redirect") as MasterPage; var page = master.CurrentPage as RedirectPage; page.YourFavoriteFood = "You've got some tasty " + param; return(master); }); Handle.GET("/KitchenSink/partial/url", () => new UrlPage()); Handle.GET("/KitchenSink/url", () => WrapPage <UrlPage>("/KitchenSink/partial/url")); Handle.GET("/KitchenSink/partial/datepicker", () => new DatepickerPage()); Handle.GET("/KitchenSink/datepicker", () => WrapPage <DatepickerPage>("/KitchenSink/partial/datepicker")); Handle.GET("/KitchenSink/partial/fileupload", () => new FileUploadPage()); Handle.GET("/KitchenSink/fileupload", () => WrapPage <FileUploadPage>("/KitchenSink/partial/fileupload")); Handle.GET("/KitchenSink/partial/callback", () => new CallbackPage()); Handle.GET("/KitchenSink/callback", () => WrapPage <CallbackPage>("/KitchenSink/partial/callback")); Handle.GET("/KitchenSink/partial/dialog", () => new DialogPage()); Handle.GET("/KitchenSink/dialog", () => WrapPage <DialogPage>("/KitchenSink/partial/dialog")); Handle.GET("/KitchenSink/partial/progressbar", () => new ProgressBarPage()); Handle.GET("/Kitchensink/progressbar", () => WrapPage <ProgressBarPage>("/KitchenSink/partial/progressbar")); Handle.GET("/KitchenSink/partial/lazyloading", () => new LazyLoadingPage()); Handle.GET("/Kitchensink/lazyloading", () => WrapPage <LazyLoadingPage>("/KitchenSink/partial/lazyloading")); Handle.GET("/KitchenSink/partial/pagination", () => new PaginationPage()); Handle.GET("/Kitchensink/pagination", () => WrapPage <PaginationPage>("/KitchenSink/partial/pagination")); Handle.GET("/KitchenSink/partial/flashmessage", () => new FlashMessagePage()); Handle.GET("/Kitchensink/flashmessage", () => WrapPage <FlashMessagePage>("/KitchenSink/partial/flashmessage")); Handle.GET("/KitchenSink/partial/clientlocalstate", () => new ClientLocalStatePage()); Handle.GET("/KitchenSink/clientlocalstate", () => WrapPage <ClientLocalStatePage>("/KitchenSink/partial/clientlocalstate")); Handle.GET("/KitchenSink/partial/cookie", (Request request) => { string name = "KitchenSink"; CookiePage page = new CookiePage(); Cookie cookie = request.Cookies.Select(x => new Cookie(x)).FirstOrDefault(x => x.Name == name); if (cookie != null) { page.RequestCookie = cookie.Value; } cookie = new Cookie() { Name = name, Value = string.Format("KitchenSinkCookie-{0}", DateTime.Now.ToString()), Expires = DateTime.Now.AddDays(1) }; Handle.AddOutgoingCookie(name, cookie.GetFullValueString()); return(page); }); Handle.GET("/KitchenSink/cookie", () => WrapPage <CookiePage>("/KitchenSink/partial/cookie")); HandleFile.GET("/KitchenSink/fileupload/upload", task => { Session.ScheduleTask(task.SessionId, (session, id) => { var master = session.Store[nameof(MasterPage)] as MasterPage; if (master == null) { return; } var page = master.CurrentPage as FileUploadPage; if (page == null) { return; } var item = page.Tasks.FirstOrDefault(x => x.FileName == task.FileName); if (task.State == HandleFile.UploadTaskState.Error) { if (item != null) { page.Tasks.Remove(item); } } else if (task.State == HandleFile.UploadTaskState.Completed) { if (item != null) { page.Tasks.Remove(item); } var file = page.Files.FirstOrDefault(x => x.FileName == task.FileName); if (file == null) { file = page.Files.Add(); } file.FileName = task.FileName; file.FileSize = task.FileSize; file.FilePath = task.FilePath; } else { if (item == null) { item = page.Tasks.Add(); } item.FileName = task.FileName; item.FileSize = task.FileSize; item.Progress = task.Progress; } session.CalculatePatchAndPushOnWebSocket(); }); }); Handle.GET("/KitchenSink/partial/autocomplete", () => Db.Scope(() => new AutocompletePage())); Handle.GET("/KitchenSink/autocomplete", () => WrapPage <AutocompletePage>("/KitchenSink/partial/autocomplete")); Handle.GET("/KitchenSink/nav", () => { return(new NavPage()); }, new HandlerOptions() { SelfOnly = true }); Handle.GET("/KitchenSink/app-name", () => { return(new AppName()); }); Handle.GET("/KitchenSink/menu", () => { return(new AppMenuPage()); }); Blender.MapUri("/KitchenSink/menu", string.Empty, new string[] { "menu" }); Blender.MapUri("/KitchenSink/app-name", string.Empty, new string[] { "app", "icon" }); }
static void Main() { var app = Application.Current; app.Use(new HtmlFromJsonProvider()); app.Use(new PartialToStandaloneHtmlProvider()); Handle.GET("/KitchenSink/master", () => { Session session = Session.Current; if (session != null && session.Data != null) { return(session.Data); } var master = new MasterPage(); if (session == null) { session = new Session(SessionOptions.PatchVersioning); } var nav = new NavPage(); master.CurrentPage = nav; master.Session = session; return(master); }); Handle.GET("/KitchenSink/json", () => { return(new Json()); }); Handle.GET("/KitchenSink", () => { return(Self.GET("/KitchenSink/text")); }); Handle.GET("/KitchenSink/partial/button", () => new ButtonPage()); Handle.GET("/KitchenSink/button", () => WrapPage <ButtonPage>("/KitchenSink/partial/button")); Handle.GET("/KitchenSink/partial/breadcrumb", () => { return(Db.Scope(() => { return new BreadcrumbPage(); })); }); Handle.GET("/KitchenSink/breadcrumb", () => WrapPage <BreadcrumbPage>("/KitchenSink/partial/breadcrumb")); Handle.GET("/KitchenSink/partial/chart", () => new ChartPage()); Handle.GET("/KitchenSink/chart", () => WrapPage <ChartPage>("/KitchenSink/partial/chart")); Handle.GET("/KitchenSink/partial/checkbox", () => new CheckboxPage()); Handle.GET("/KitchenSink/checkbox", () => WrapPage <CheckboxPage>("/KitchenSink/partial/checkbox")); Handle.GET("/KitchenSink/partial/togglebutton", () => new ToggleButtonPage()); Handle.GET("/KitchenSink/togglebutton", () => WrapPage <ToggleButtonPage>("/KitchenSink/partial/togglebutton")); Handle.GET("/KitchenSink/partial/datagrid", () => new DatagridPage()); Handle.GET("/KitchenSink/datagrid", () => WrapPage <DatagridPage>("/KitchenSink/partial/datagrid")); Handle.GET("/KitchenSink/partial/decimal", () => new DecimalPage()); Handle.GET("/KitchenSink/decimal", () => WrapPage <DecimalPage>("/KitchenSink/partial/decimal")); Handle.GET("/KitchenSink/partial/dropdown", () => new DropdownPage()); Handle.GET("/KitchenSink/dropdown", () => WrapPage <DropdownPage>("/KitchenSink/partial/dropdown")); Handle.GET("/KitchenSink/partial/html", () => new HtmlPage()); Handle.GET("/KitchenSink/html", () => WrapPage <HtmlPage>("/KitchenSink/partial/html")); Handle.GET("/KitchenSink/partial/integer", () => new IntegerPage()); Handle.GET("/KitchenSink/integer", () => WrapPage <IntegerPage>("/KitchenSink/partial/integer")); Handle.GET("/KitchenSink/partial/Geo", () => { return(Db.Scope(() => { var geoPage = new GeoPage(); geoPage.Init(); return geoPage; })); }); Handle.GET("/KitchenSink/Geo", () => WrapPage <GeoPage>("/KitchenSink/partial/Geo")); Handle.GET("/KitchenSink/partial/markdown", () => new MarkdownPage()); Handle.GET("/KitchenSink/markdown", () => WrapPage <MarkdownPage>("/KitchenSink/partial/markdown")); Handle.GET("/KitchenSink/partial/nested", () => new NestedPartial { Data = new AnyData() }); Handle.GET("/KitchenSink/nested", () => WrapPage <NestedPartial>("/KitchenSink/partial/nested")); Handle.GET("/KitchenSink/partial/radiolist", () => new RadiolistPage()); Handle.GET("/KitchenSink/radiolist", () => WrapPage <RadiolistPage>("/KitchenSink/partial/radiolist")); Handle.GET("/KitchenSink/partial/multiselect", () => new MultiselectPage()); Handle.GET("/KitchenSink/multiselect", () => WrapPage <MultiselectPage>("/KitchenSink/partial/multiselect")); Handle.GET("/KitchenSink/partial/password", () => new PasswordPage()); Handle.GET("/KitchenSink/password", () => WrapPage <PasswordPage>("/KitchenSink/partial/password")); Handle.GET("/KitchenSink/partial/table", () => new TablePage()); Handle.GET("/KitchenSink/table", () => WrapPage <TablePage>("/KitchenSink/partial/table")); Handle.GET("/KitchenSink/partial/sortablelist", () => new SortableList()); Handle.GET("/KitchenSink/sortablelist", () => WrapPage <SortableList>("/KitchenSink/partial/sortablelist")); Handle.GET("/KitchenSink/partial/text", () => new TextPage()); Handle.GET("/KitchenSink/text", () => WrapPage <TextPage>("/KitchenSink/partial/text")); Handle.GET("/KitchenSink/partial/textarea", () => new TextareaPage()); Handle.GET("/KitchenSink/textarea", () => WrapPage <TextareaPage>("/KitchenSink/partial/textarea")); Handle.GET("/KitchenSink/partial/radio", () => new RadioPage()); Handle.GET("/KitchenSink/radio", () => WrapPage <RadioPage>("/KitchenSink/partial/radio")); Handle.GET("/KitchenSink/partial/Redirect", () => new RedirectPage()); Handle.GET("/KitchenSink/Redirect", () => WrapPage <RedirectPage>("/KitchenSink/partial/Redirect")); Handle.GET("/KitchenSink/partial/Validation", () => new ValidationPage()); Handle.GET("/KitchenSink/Validation", () => WrapPage <ValidationPage>("/KitchenSink/partial/Validation")); Handle.GET("/KitchenSink/Redirect/{?}", (string param) => { var master = WrapPage <RedirectPage>("/KitchenSink/partial/Redirect") as MasterPage; var nav = master.CurrentPage as NavPage; var page = nav.CurrentPage as RedirectPage; page.YourFavoriteFood = "You've got some tasty " + param; return(master); }); Handle.GET("/KitchenSink/partial/url", () => new UrlPage()); Handle.GET("/KitchenSink/url", () => WrapPage <UrlPage>("/KitchenSink/partial/url")); Handle.GET("/KitchenSink/partial/datepicker", () => new DatepickerPage()); Handle.GET("/KitchenSink/datepicker", () => WrapPage <DatepickerPage>("/KitchenSink/partial/datepicker")); Handle.GET("/KitchenSink/partial/fileupload", () => new FileUploadPage()); Handle.GET("/KitchenSink/fileupload", () => WrapPage <FileUploadPage>("/KitchenSink/partial/fileupload")); Handle.GET("/KitchenSink/partial/callback", () => new CallbackPage()); Handle.GET("/KitchenSink/callback", () => WrapPage <CallbackPage>("/KitchenSink/partial/callback")); Handle.GET("/KitchenSink/partial/dialog", () => new DialogPage()); Handle.GET("/KitchenSink/dialog", () => WrapPage <DialogPage>("/KitchenSink/partial/dialog")); Handle.GET("/KitchenSink/partial/cookie", (Request request) => { string name = "KitchenSink"; CookiePage page = new CookiePage(); Cookie cookie = request.Cookies.Select(x => new Cookie(x)).FirstOrDefault(x => x.Name == name); if (cookie != null) { page.RequestCookie = cookie.Value; } cookie = new Cookie() { Name = name, Value = string.Format("KitchenSinkCookie-{0}", DateTime.Now.ToString()), Expires = DateTime.Now.AddDays(1) }; Handle.AddOutgoingCookie(name, cookie.GetFullValueString()); return(page); }); Handle.GET("/KitchenSink/cookie", () => WrapPage <CookiePage>("/KitchenSink/partial/cookie")); HandleFile.GET("/KitchenSink/fileupload/upload", task => { Session.ScheduleTask(task.SessionId, (s, id) => { MasterPage master = s.Data as MasterPage; if (master == null) { return; } NavPage nav = master.CurrentPage as NavPage; if (nav == null) { return; } FileUploadPage page = nav.CurrentPage as FileUploadPage; if (page == null) { return; } var item = page.Tasks.FirstOrDefault(x => x.FileName == task.FileName); if (task.State == HandleFile.UploadTaskState.Error) { if (item != null) { page.Tasks.Remove(item); } } else if (task.State == HandleFile.UploadTaskState.Completed) { if (item != null) { page.Tasks.Remove(item); } var file = page.Files.FirstOrDefault(x => x.FileName == task.FileName); if (file == null) { file = page.Files.Add(); } file.FileName = task.FileName; file.FileSize = task.FileSize; file.FilePath = task.FilePath; } else { if (item == null) { item = page.Tasks.Add(); } item.FileName = task.FileName; item.FileSize = task.FileSize; item.Progress = task.Progress; } s.CalculatePatchAndPushOnWebSocket(); }); }); Handle.GET("/KitchenSink/partial/autocomplete", () => Db.Scope(() => new AutocompletePage().Init())); Handle.GET("/KitchenSink/autocomplete", () => WrapPage <AutocompletePage>("/KitchenSink/partial/autocomplete")); //for a launcher Handle.GET("/KitchenSink/app-name", () => { return(new AppName()); }); Handle.GET("/KitchenSink/menu", () => { return(new AppMenuPage()); }); UriMapping.Map("/KitchenSink/menu", UriMapping.MappingUriPrefix + "/menu"); UriMapping.Map("/KitchenSink/app-name", UriMapping.MappingUriPrefix + "/app-name"); }
private static void Main() { var app = Application.Current; app.Use(new HtmlFromJsonProvider()); app.Use(new PartialToStandaloneHtmlProvider()); DummyData.Create(); // just to offer a REST endpoint that gives the app version, usable for diagnostics // (currently used in github-source-links) Handle.GET("/UniformDocs/uniformdocs-app-version", () => GetAppVersionFromAssemblyFile()); Handle.GET("/UniformDocs/partial/mainpage", () => new MainPage()); Handle.GET("/UniformDocs/mainpage", () => WrapPage <MainPage>("/UniformDocs/partial/mainpage")); Handle.GET("/UniformDocs/partial/uikit", () => new UIKitPage()); Handle.GET("/UniformDocs/uikit", () => WrapPage <UIKitPage>("/UniformDocs/partial/uikit")); Handle.GET("/UniformDocs", () => Self.GET("/UniformDocs/mainpage")); Handle.GET("/UniformDocs/nav", () => new NavPage()); Handle.GET("/UniformDocs/app-name", () => new AppName()); Handle.GET("/UniformDocs/menu", () => new AppMenuPage()); #region Design Handle.GET("/UniformDocs/partial/sections", () => new SectionsPage()); Handle.GET("/UniformDocs/sections", () => WrapPage <SectionsPage>("/UniformDocs/partial/sections")); Handle.GET("/UniformDocs/partial/card", () => new CardPage()); Handle.GET("/UniformDocs/card", () => WrapPage <CardPage>("/UniformDocs/partial/card")); Handle.GET("/UniformDocs/partial/alerts", () => new AlertsPage()); Handle.GET("/UniformDocs/alerts", () => WrapPage <AlertsPage>("/UniformDocs/partial/alerts")); Handle.GET("/UniformDocs/partial/leftnavlayout", () => new LeftNavLayoutPage()); Handle.GET("/UniformDocs/leftnavlayout", () => WrapPage <LeftNavLayoutPage>("/UniformDocs/partial/leftnavlayout")); Handle.GET("/UniformDocs/partial/native", () => new NativePage()); Handle.GET("/UniformDocs/native", () => WrapPage <NativePage>("/UniformDocs/partial/native")); #endregion #region Components Handle.GET("/UniformDocs/partial/autocomplete", () => Db.Scope(() => new AutocompletePage())); Handle.GET("/UniformDocs/autocomplete", () => WrapPage <AutocompletePage>("/UniformDocs/partial/autocomplete")); Handle.GET("/UniformDocs/partial/breadcrumb", () => { return(Db.Scope(() => new BreadcrumbPage())); }); Handle.GET("/UniformDocs/breadcrumb", () => WrapPage <BreadcrumbPage>("/UniformDocs/partial/breadcrumb")); Handle.GET("/UniformDocs/partial/button", () => new ButtonPage()); Handle.GET("/UniformDocs/button", () => WrapPage <ButtonPage>("/UniformDocs/partial/button")); Handle.GET("/UniformDocs/partial/chart", () => new ChartPage()); Handle.GET("/UniformDocs/chart", () => WrapPage <ChartPage>("/UniformDocs/partial/chart")); Handle.GET("/UniformDocs/partial/checkbox", () => new CheckboxPage()); Handle.GET("/UniformDocs/checkbox", () => WrapPage <CheckboxPage>("/UniformDocs/partial/checkbox")); Handle.GET("/UniformDocs/partial/datepicker", () => new DatepickerPage()); Handle.GET("/UniformDocs/datepicker", () => WrapPage <DatepickerPage>("/UniformDocs/partial/datepicker")); Handle.GET("/UniformDocs/partial/dropdown", () => new DropdownPage()); Handle.GET("/UniformDocs/dropdown", () => WrapPage <DropdownPage>("/UniformDocs/partial/dropdown")); Handle.GET("/UniformDocs/partial/decimal", () => new DecimalPage()); Handle.GET("/UniformDocs/decimal", () => WrapPage <DecimalPage>("/UniformDocs/partial/decimal")); Handle.GET("/UniformDocs/partial/formitem", () => { var formItemPage = new FormItemPage(); formItemPage.Init(); return(formItemPage); }); Handle.GET("/UniformDocs/formitem", () => WrapPage <FormItemPage>("/UniformDocs/partial/formitem")); Handle.GET("/UniformDocs/partial/formitemgroup", () => { var formItemGroupPage = new FormItemGroupPage(); formItemGroupPage.Init(); return(formItemGroupPage); }); Handle.GET("/UniformDocs/formitemgroup", () => WrapPage <FormItemGroupPage>("/UniformDocs/partial/formitemgroup")); Handle.GET("/UniformDocs/partial/html", () => new HtmlPage()); Handle.GET("/UniformDocs/html", () => WrapPage <HtmlPage>("/UniformDocs/partial/html")); Handle.GET("/UniformDocs/partial/integer", () => new IntegerPage()); Handle.GET("/UniformDocs/integer", () => WrapPage <IntegerPage>("/UniformDocs/partial/integer")); Handle.GET("/UniformDocs/partial/url", () => new UrlPage()); Handle.GET("/UniformDocs/url", () => WrapPage <UrlPage>("/UniformDocs/partial/url")); Handle.GET("/UniformDocs/download?session={?}", (string id) => { var ids = new string[] { id }; Session.RunTask(ids, (session, sessionId) => { var masterPage = Session.Ensure().Store[nameof(MasterPage)] as MasterPage; var urlPage = masterPage.CurrentPage as UrlPage; if (urlPage != null) { urlPage.DownloadStarted(); session.CalculatePatchAndPushOnWebSocket(); } }); return(Self.GET("/UniformDocs/images/UniformDocs.svg")); }); Handle.GET("/UniformDocs/partial/Geo", () => { return(Db.Scope(() => { var geoPage = new GeoPage(); geoPage.Init(); return geoPage; })); }); Handle.GET("/UniformDocs/Geo", () => WrapPage <GeoPage>("/UniformDocs/partial/Geo")); Handle.GET("/UniformDocs/partial/markdown", () => new MarkdownPage()); Handle.GET("/UniformDocs/markdown", () => WrapPage <MarkdownPage>("/UniformDocs/partial/markdown")); Handle.GET("/UniformDocs/partial/multiselect", () => new MultiselectPage()); Handle.GET("/UniformDocs/multiselect", () => WrapPage <MultiselectPage>("/UniformDocs/partial/multiselect")); Handle.GET("/UniformDocs/partial/pagination", () => new PaginationPage()); Handle.GET("/Uniformdocs/pagination", () => WrapPage <PaginationPage>("/UniformDocs/partial/pagination")); Handle.GET("/UniformDocs/partial/password", () => new PasswordPage()); Handle.GET("/UniformDocs/password", () => WrapPage <PasswordPage>("/UniformDocs/partial/password")); Handle.GET("/UniformDocs/partial/radio", () => new RadioPage()); Handle.GET("/UniformDocs/radio", () => WrapPage <RadioPage>("/UniformDocs/partial/radio")); Handle.GET("/UniformDocs/partial/radiolist", () => new RadiolistPage()); Handle.GET("/UniformDocs/radiolist", () => WrapPage <RadiolistPage>("/UniformDocs/partial/radiolist")); Handle.GET("/UniformDocs/partial/table", () => new TablePage()); Handle.GET("/UniformDocs/table", () => WrapPage <TablePage>("/UniformDocs/partial/table")); Handle.GET("/UniformDocs/partial/text", () => new TextPage()); Handle.GET("/UniformDocs/text", () => WrapPage <TextPage>("/UniformDocs/partial/text")); Handle.GET("/UniformDocs/partial/textarea", () => new TextareaPage()); Handle.GET("/UniformDocs/textarea", () => WrapPage <TextareaPage>("/UniformDocs/partial/textarea")); Handle.GET("/UniformDocs/partial/togglebutton", () => new ToggleButtonPage()); Handle.GET("/UniformDocs/togglebutton", () => WrapPage <ToggleButtonPage>("/UniformDocs/partial/togglebutton")); Handle.GET("/UniformDocs/partial/datatable", () => { return(Db.Scope(() => { var dataTablePage = new DataTablePage(); dataTablePage.Init(); return dataTablePage; })); }); Handle.GET("/UniformDocs/datatable", () => WrapPage <DataTablePage>("/UniformDocs/partial/datatable")); #endregion #region How to Handle.GET("/UniformDocs/partial/callback", () => new CallbackPage()); Handle.GET("/UniformDocs/callback", () => WrapPage <CallbackPage>("/UniformDocs/partial/callback")); Handle.GET("/UniformDocs/partial/clientlocalstate", () => new ClientLocalStatePage()); Handle.GET("/UniformDocs/clientlocalstate", () => WrapPage <ClientLocalStatePage>("/UniformDocs/partial/clientlocalstate")); Handle.GET("/UniformDocs/partial/blendablemenu/menulinks", () => new MenuLinksPage()); // Handle.GET("/UniformDocs/blendablemenu/menulinks", () => WrapPage<MenuLinksPage>("/UniformDocs/partial/blendablemenu/menulinks")); Handle.GET("/UniformDocs/partial/blendablemenu/menubuttons", () => new MenuButtonsPage()); // Handle.GET("/UniformDocs/blendablemenu/menubuttons", () => WrapPage<MenuButtonsPage>("/UniformDocs/partial/blendablemenu/menubuttons")); // pretend it's the other app Handle.GET("/UniformDocs/partial/blendablemenu/othermenubuttons", () => new MenuButtonsPage()); // Handle.GET("/UniformDocs/blendablemenu/menubuttons", () => WrapPage<MenuButtonsPage>("/UniformDocs/partial/blendablemenu/menubuttons")); Handle.GET("/UniformDocs/partial/blendablemenu", () => new BlendableMenuPage { GridMenu = Self.GET("/UniformDocs/partial/blendablemenu/menubuttons"), ListMenu = Self.GET("/UniformDocs/partial/blendablemenu/menulinks") }); Handle.GET("/UniformDocs/blendablemenu", () => WrapPage <BlendableMenuPage>("/UniformDocs/partial/blendablemenu")); Handle.GET("/UniformDocs/partial/cookie", (Request request) => { string name = "UniformDocs"; CookiePage page = new CookiePage(); Cookie cookie = request.Cookies.Select(x => new Cookie(x)).FirstOrDefault(x => x.Name == name); if (cookie != null) { page.RequestCookie = cookie.Value; } cookie = new Cookie { Name = name, Value = $"UniformDocsCookie-{DateTime.Now.ToString()}", Expires = DateTime.Now.AddDays(1) }; Handle.AddOutgoingCookie(name, cookie.GetFullValueString()); return(page); }); Handle.GET("/UniformDocs/cookie", () => WrapPage <CookiePage>("/UniformDocs/partial/cookie")); Handle.GET("/UniformDocs/partial/dialog", () => new DialogPage()); Handle.GET("/UniformDocs/dialog", () => WrapPage <DialogPage>("/UniformDocs/partial/dialog")); Handle.GET("/UniformDocs/partial/fileupload", () => new FileUploadPage()); Handle.GET("/UniformDocs/fileupload", () => WrapPage <FileUploadPage>("/UniformDocs/partial/fileupload")); HandleFile.GET("/UniformDocs/fileupload/upload", task => { Session.RunTask(task.SessionId, (session, id) => { var master = session.Store[nameof(MasterPage)] as MasterPage; var page = master?.CurrentPage as FileUploadPage; if (page == null) { return; } var item = page.Tasks.FirstOrDefault(x => x.FileName == task.FileName); switch (task.State) { case HandleFile.UploadTaskState.Error: if (item != null) { page.Tasks.Remove(item); } break; case HandleFile.UploadTaskState.Completed: if (item != null) { page.Tasks.Remove(item); } var file = page.Files.FirstOrDefault(x => x.FileName == task.FileName) ?? page.Files.Add(); file.FileName = task.FileName; file.FileSize = task.FileSize; file.FilePath = task.FilePath; break; default: if (item == null) { item = page.Tasks.Add(); } item.FileName = task.FileName; item.FileSize = task.FileSize; item.Progress = task.Progress; break; } session.CalculatePatchAndPushOnWebSocket(); }); }); Handle.GET("/UniformDocs/partial/flashmessage", () => new FlashMessagePage()); Handle.GET("/Uniformdocs/flashmessage", () => WrapPage <FlashMessagePage>("/UniformDocs/partial/flashmessage")); Handle.GET("/UniformDocs/partial/lazyloading", () => new LazyLoadingPage()); Handle.GET("/Uniformdocs/lazyloading", () => WrapPage <LazyLoadingPage>("/UniformDocs/partial/lazyloading")); Handle.GET("/UniformDocs/partial/nested", () => new NestedPartial { Data = new AnyData() }); Handle.GET("/UniformDocs/nested", () => WrapPage <NestedPartial>("/UniformDocs/partial/nested")); Handle.GET("/UniformDocs/partial/progressbar", () => new ProgressBarPage()); Handle.GET("/Uniformdocs/progressbar", () => WrapPage <ProgressBarPage>("/UniformDocs/partial/progressbar")); Handle.GET("/UniformDocs/partial/Redirect", () => new RedirectPage()); Handle.GET("/UniformDocs/Redirect", () => WrapPage <RedirectPage>("/UniformDocs/partial/Redirect")); Handle.GET("/UniformDocs/Redirect/{?}", (string param) => { var master = WrapPage <RedirectPage>("/UniformDocs/partial/Redirect") as MasterPage; var page = master.CurrentPage as RedirectPage; page.YourFavoriteFood = "You've got some tasty " + param; return(master); }); #endregion }