/// <summary> /// A post query is always associated with a nav. /// </summary> /// <param name="navSlug"></param> public PostQuery(Nav nav, QueryBy queryBy, int pageIndex) { this.Nav = nav; this.QueryBy = queryBy; this.PageIndex = pageIndex; this.PageSize = BlogConfig.PostList_PageSize; }
public void Given() { BlogsTestConfig.Initialize(); _nav = AdminManager.AddNav(BlogsTestConfig.NavSlug, "Test Nav", "A nav for testing", BlogsTestConfig.BlogAppId); _postId = BlogApp.AddArticle(_nav, BlogsTestConfig.Subject, BlogsTestConfig.Body, BlogsTestConfig.PostSlug, "", DateTime.Now, PostStatus.Published).PostId; // publish }
/// <summary> /// /// </summary> /// <param name="nav"></param> /// <param name="year"></param> /// <param name="month"></param> /// <param name="monthlyPostCount"></param> public Archive(Nav nav, int year, int month, int monthlyPostCount) { Year = year; Month = month; MonthlyPostCount = monthlyPostCount; Nav = nav; }
void Start(){ target = new Vector2 (); playerNavigation = GetComponent<Nav> (); seeker = this.transform; mousePressed = false; }
public void SetUp() { BlogsTestConfig.Initialize(); nav = AdminManager.AddNav("test", "Test", "A nav for testing", BlogsTestConfig.BlogAppId); _postId1 = BlogApp.AddArticle(nav, "title1", "body1", "slug1", "", DateTime.Now, PostStatus.Published).PostId; _postId2 = BlogApp.AddArticle(nav, "title2", "body2", "slug2", "", DateTime.Now, PostStatus.Published).PostId; }
/// <summary> /// /// </summary> /// <param name="nav"></param> /// <param name="postList"></param> /// <param name="blogIndexType"></param> /// <param name="pageIndex"></param> public BlogIndexModel(Nav nav, PostList postList, BlogIndexType blogIndexType, int pageIndex) { Nav = nav; PostList = postList; ListType = blogIndexType; PageIndex = pageIndex; }
public void SetUp() { BlogsTestConfig.Initialize(); _nav = AdminManager.AddNav(BlogsTestConfig.NavSlug, "Test Nav", "A nav for testing", BlogsTestConfig.BlogAppId); string tagString = "tag1, tag2, tag3, 中文贴, 音乐"; _postId = BlogApp.AddArticle(_nav, BlogsTestConfig.Subject, BlogsTestConfig.Body, BlogsTestConfig.PostSlug, tagString, DateTime.Now, PostStatus.Draft).PostId; // draft }
private NavDto ConvertToDto(Nav nav) { return new NavDto { Nav = nav.Nav1, Date = nav.Date, Split = nav.Split }; }
public void Tag_Update_Duplicate_Name_Is_Not_Allowed() { /////////////////////////////////////////////////////////////////// // When /////////////////////////////////////////////////////////////////// Nav nav = new Nav { NavId = 2, Slug = "test", }; var test = BlogApp.GetTags(nav); /////////////////////////////////////////////////////////////////// // Then /////////////////////////////////////////////////////////////////// }
public MockBlogProvider() { nav = new Nav { Slug = "tech", }; tagList = new List<Tag> { new Tag(nav) { TagId = 1, TagName = WebHelper.UrlEncode("asp.net"), } }; postList = new List<Post> { new Article(nav) { PostId = 1, //NavSlug = "tech", //PostType = PostType.Article, Subject = "My first post", PostSlug = "my-first-post", DateCreated = DateTime.Now, Tags = tagList, Body = "Hi, this is my first post", }, new Gallery(nav) { PostId = 2, // NavSlug = "tech", // PostType = PostType.Gallery, Subject = "My first photo gallery", PostSlug = "my-first-photo-gallery", //UserName = "******", DateCreated = DateTime.Now, Tags = tagList, Body = "my first gallery body", } }; photoList = new List<GalleryPhoto>(); }
public int AddNav(Nav nav) { using (var db = new AdminDbContext()) { if (db.Navs.FirstOrDefault(n => n.Slug.ToLower() == nav.Slug.ToLower()) != null) throw new SiteException(string.Format("Slug '{0}' exists already.", nav.Slug)); db.Navs.Add(nav); // update app var app = db.Apps.FirstOrDefault(a => a.AppId == nav.AppId); if (app == null) throw new SiteException("App not found."); app.InstanceCount++; db.SaveChanges(); return nav.NavId; } }
public TestBot(Nav.D3.Navmesh navmesh, Vec3 pos, Vec3 dest, bool explore = false, bool simulate_stuck = false, int dest_grid_id = -1, List<Vec3> waypoints = null) { m_Navmesh = navmesh; m_Navmesh.Navigator.AddListener(this); m_Navmesh.Navigator.CurrentPos = pos; m_Navmesh.Navigator.Precision = 2; m_Navmesh.Explorator.Enabled = explore; m_Navmesh.Navigator.DestinationGridsId = dest_grid_id != -1 ? new List<int>(new int[]{dest_grid_id}) : null; if (waypoints != null) m_Navmesh.Navigator.Waypoints = waypoints; Destination = dest; m_Navmesh.Navigator.EnableAntiStuck = true; m_GotoPosUpdateTimer.Start(); Paused = false; SimulateStuck = simulate_stuck; }
public ActionResult NavAdd(string name, string slug, string description, int appId) { try { AdminManager.AddNav(slug, name, description, appId); return RedirectToAction("Navs"); } catch (SiteException e) { Nav nav = new Nav { Name = name, Slug = slug, Description = description, App = AdminManager.GetApp(appId), }; ModelState.AddModelError("", e.Message); return View("NavAdd", nav); } }
/// <summary> /// Adds a nav. /// </summary> /// <param name="slug"></param> /// <param name="name"></param> /// <param name="description"></param> public static Nav AddNav(string slug, string name, string description, int appId) { var nav = new Nav { Slug = Nav.FormatNavSlug(slug), // TODO: format NavSlug in AddNav Name = WebHelper.HtmlEncode(name), Description = WebHelper.HtmlEncode(description), DateCreated = DateTime.UtcNow, AppId = appId, }; var validator = new NavValidator(); ValidationResult results = validator.Validate(nav); if (!results.IsValid) { throw new Exception(results.Errors[0].ErrorMessage); } Provider.AddNav(nav); SiteCache.Remove(AdminManager._GetCacheKey_Nav(nav.Slug)); return nav; }
public static Nav ToEntity(this NavViewModel model, Nav entity) { return(model.MapTo(entity)); }
public void Init(Nav navigation) { }
public BlogImage(Nav nav) { Nav = nav; DateUploaded = DateTime.UtcNow; }
/// <summary> /// Updates a nav by its slug. /// </summary> /// <param name="navSlug">The slug of the existing nav you are updating.</param> /// <param name="name">new name</param> /// <param name="slug">new slug</param> /// <param name="description">new description</param> /// <remarks> /// Should I allow navSlug to be updated after creation? Right now yes. /// </remarks> public static void UpdateNav(string navSlug, string name, string slug, string description) { var nav = new Nav { NavId = GetNavId(navSlug), Slug = Nav.FormatNavSlug(slug), // TODO: format NavSlug in UpdateNav Name = WebHelper.HtmlEncode(name), Description = WebHelper.HtmlEncode(description), }; var validator = new NavValidator(); ValidationResult results = validator.Validate(nav); if (!results.IsValid) { throw new Exception(results.Errors[0].ErrorMessage); } SiteCache.Remove(AdminManager._GetCacheKey_Nav(navSlug)); Provider.UpdateNav(nav); }
void Awake() { instance = this; }
public void Init(Nav navigation) { // get card detail from service using id _id = navigation.Id; Refresh(); }
public void LogOut() { Nav.NavigateTo("/.auth/logout?post_logout_redirect_uri=/", forceLoad: true); }
public MainWindow() { InitializeComponent(); Nav.GetInstance().ChangeView += MainWindow_ChangeView; }
private void OnThemeChanged(string value) { settings.CustomizationSettings.Theme = value; Nav.NavigateTo("/settings/openbullet", true); }
public void ShouldRedirectTo(string path) { Nav.Expect(() => Path.StartsWith(path), $"Should have navigated to {path}"); }
public void ShouldRedirectTo <T>() where T : class, new() { var path = _urlLookup.For <T>(); Nav.Expect(() => Path.StartsWith(path), $"Should have navigated to {path}"); }
public SettingsViewModel() { SaveCommand = new Command(OnSave); BackCommand = new Command(async() => await Nav.PopModalAsync()); LogoutCommand = new Command(OnLogout); }
async Task LogoutButtonTapped() { Settings.LogoutUser(); await Nav.Go <Pages.Login>(); }
private void NavigateBack() { Nav.NavigateTo("MainPage"); }
private async Task OnChangePassword() { await Nav.NavigateTo(new ResetPasswordPage()); }
private async Task OnRepack() { await Nav.NavigateTo(new DrvPackingSlipSubmitPage(_packingSlip)); }
public static void Render(Nav.Cell cell, PointF trans, PaintEventArgs e, bool draw_connections, bool draw_id, float max_move_cost_mult) { if (cell.Disabled) return; DrawRectangle(e.Graphics, cell.Replacement ? REPLACEMENT_CELL_BORDER_PEN : CELL_BORDER_PEN, trans, cell.Min, cell.Max); Color cell_color = Color.White; int move_cost_level = 255; if (cell.MovementCostMult > 1) { move_cost_level = 255 - (int)Math.Min(GetProportional(cell.MovementCostMult, 1, 100, 20, 255), 255); cell_color = Color.FromArgb(255, 255, move_cost_level, move_cost_level); } else if (cell.MovementCostMult < 1) { move_cost_level = 255 - (int)Math.Min(GetProportional(cell.MovementCostMult, 0, 1, 20, 255), 255); cell_color = Color.FromArgb(255, move_cost_level, 255, move_cost_level); } FillRectangle(e.Graphics, cell.Flags == MovementFlag.Fly ? Brushes.Gray : new SolidBrush(cell_color), trans, cell.Min, cell.Max); if (draw_connections) { foreach (Nav.Cell.Neighbour neighbour in cell.Neighbours) DrawLine(e.Graphics, CELL_CONNECTION_PEN, trans, cell.Center, neighbour.border_point); } if (draw_id) DrawString(e.Graphics, Brushes.Black, trans, cell.Min, cell.Id.ToString(), 2); }
/// <summary> /// Returns a <see cref="Fan.Blogs.Post"/> given a <see cref="PostEntity"/>, maps to the post's specific type. /// </summary> /// <remarks> /// /// </remarks> /// <exception cref="BlogException">If the PostType is not defined</exception> internal static Post MapPost(PostEntity postEnt, Nav nav, User user) { // take tags out from PostEntity List<Tag> tagList = new List<Tag>(); foreach (var tagEnt in postEnt.TagEntities) { tagList.Add(new Tag(nav) { TagId = tagEnt.TagId, TagName = WebHelper.UrlDecode(tagEnt.Name), PostCount = tagEnt.PostEntities.Count, Description = tagEnt.Description, }); } // fill in PostType specific post switch ((PostType)postEnt.PostType) { case PostType.Article: return _MapArticle(postEnt, nav, tagList, user); default: throw new SiteException("Not supported post type."); } }
public void CreateNewSession() { Nav.NavigateTo("/host", forceLoad: true); }
/// <summary> /// /// </summary> /// <param name="postEnt"></param> /// <param name="nav"></param> /// <param name="tagList"></param> /// <param name="user"></param> /// <returns></returns> private static Article _MapArticle(PostEntity postEnt, Nav nav, List<Tag> tagList, User user) { var md = new MarkdownDeep.Markdown(); return new Article(nav) { PostId = postEnt.PostId, PostGuidId = postEnt.PostGuidId, PostStatus = postEnt.PostStatus, UserId = postEnt.UserId, Author = user.DisplayName, Email = user.Email, UserName = user.UserName, PostSlug = postEnt.Slug, Subject = WebHelper.HtmlDecode(postEnt.Subject), // TODO: should I decode here? Body = postEnt.Body, DateCreated = postEnt.DateCreated, DateUpdated = postEnt.DateUpdated, ViewCount = postEnt.ViewCount, IP = postEnt.IP, Tags = tagList, }; }
public void SetUp() { BlogsTestConfig.Initialize(); _nav = AdminManager.GetNav("tech"); _postId = BlogApp.AddArticle(_nav, BlogsTestConfig.Subject, BlogsTestConfig.Body, BlogsTestConfig.PostSlug, "", DateTime.Now, PostStatus.Published).PostId; // publish }
public Gallery(Nav nav) : base(nav) { PostType = PostType.Gallery; Photos = new List<GalleryPhoto>(); }
private async Task OnSign() { await Nav.NavigateTo(new DrvPackingSlipSignPage(new[] { _packingSlip })); }
private async void OnLogout() { ApplicationStore.Logout(); await Nav.PopModalAsync(); }
internal static List<Archive> MapArchive(List<ArchiveEntity> ents, Nav nav) { if (ents == null || ents.Count <= 0) return new List<Archive>(); int count = ents.Count; List<Archive> list = new List<Archive>(); Archive arch = null; for (int y = count - 1; y >= 0; y--) { int year = ents[y].Year; if (ents[y].M12 > 0) { arch = new Archive(nav, year, 12, ents[y].M12); list.Add(arch); } if (ents[y].M11 > 0) { arch = new Archive(nav, year, 11, ents[y].M11); list.Add(arch); } if (ents[y].M10 > 0) { arch = new Archive(nav, year, 10, ents[y].M10); list.Add(arch); } if (ents[y].M09 > 0) { arch = new Archive(nav, year, 9, ents[y].M09); list.Add(arch); } if (ents[y].M08 > 0) { arch = new Archive(nav, year, 8, ents[y].M08); list.Add(arch); } if (ents[y].M07 > 0) { arch = new Archive(nav, year, 7, ents[y].M07); list.Add(arch); } if (ents[y].M06 > 0) { arch = new Archive(nav, year, 6, ents[y].M06); list.Add(arch); } if (ents[y].M05 > 0) { arch = new Archive(nav, year, 5, ents[y].M05); list.Add(arch); } if (ents[y].M04 > 0) { arch = new Archive(nav, year, 4, ents[y].M04); list.Add(arch); } if (ents[y].M03 > 0) { arch = new Archive(nav, year, 3, ents[y].M03); list.Add(arch); } if (ents[y].M02 > 0) { arch = new Archive(nav, year, 2, ents[y].M02); list.Add(arch); } if (ents[y].M01 > 0) { arch = new Archive(nav, year, 1, ents[y].M01); list.Add(arch); } } /////////// var newList = list .GroupBy(u => u.Year) .Select(grp => grp.ToList()) .ToList(); int yearPostCount = 0; foreach (var aList in newList) { foreach (var item in aList) { yearPostCount = yearPostCount + item.MonthlyPostCount; } foreach (var item in aList) { item.YearlyPostCount = yearPostCount; } yearPostCount = 0; } //////////// return list; }
private async Task SaveContact() { int errs = 0; int emailerrs = 0; int numberrs = 0; var cfg = new AlertConfig(); cfg.Message = "Faltan algunos campos, revise por favor. "; cfg.OkText = "Ok"; if (String.IsNullOrEmpty(contact.Company)) { errs++; cfg.Message += $"{Environment.NewLine}Falta la compañia"; } foreach (Email e in contact.Emails) { if (!e.IsValid) { emailerrs++; } } if (emailerrs > 0) { errs++; cfg.Message += $"{Environment.NewLine}Falta algun email o no es valido"; } if (String.IsNullOrEmpty(contact.LastName)) { errs++; cfg.Message += $"{Environment.NewLine}Falta el apellido"; } if (String.IsNullOrEmpty(contact.Name)) { errs++; cfg.Message += $"{Environment.NewLine}Falta el nombre"; } foreach (PhoneNumber n in contact.PhoneNumbers) { if (!n.IsValid) { numberrs++; } } if (numberrs > 0) { errs++; cfg.Message += $"{Environment.NewLine}Falta algun numero o no es valido"; } if (String.IsNullOrEmpty(contact.Photo)) { errs++; cfg.Message += $"{Environment.NewLine}Falta la fotografia"; } if (errs > 0) { await Diag.AlertAsync(cfg); } else { var tmp = Settings.LstContacts; contact.EmailsAddress = contact.Emails.Select(x => x.EmailAddr).ToList(); tmp.Add(contact); Settings.LstContacts = tmp; await Nav.PopAsync(); } }
public void Setup() { BlogsTestConfig.Initialize(); nav = AdminManager.AddNav("test", "Test", "A nav for testing", BlogsTestConfig.BlogAppId); }
private async Task EditConfig() { if (selectedConfig == null) { await ShowNoConfigSelectedMessage(); return; } if (selectedConfig.IsRemote) { await js.AlertError(Loc["RemoteConfig"], Loc["CannotEditRemoteConfig"]); return; } // Check if we have all required plugins var loadedPlugins = PluginRepo.GetPlugins(); if (selectedConfig.Metadata.Plugins != null) { foreach (var plugin in selectedConfig.Metadata.Plugins) { if (!loadedPlugins.Any(p => p.FullName == plugin)) { await js.AlertWarning(Loc["MissingPlugin"], $"{Loc["MissingPluginText"]}: {plugin}"); } } } // Check if the previous config was saved if (ConfigService.SelectedConfig != null && ConfigService.SelectedConfig != selectedConfig && ConfigService.SelectedConfig.HasUnsavedChanges()) { if (!await js.Confirm(Loc["UnsavedChanges"], Loc["UnsavedChangesText"], Loc["Cancel"])) { return; } } ConfigService.SelectedConfig = selectedConfig; var section = PersistentSettings.OpenBulletSettings.GeneralSettings.ConfigSectionOnLoad; var uri = string.Empty; if (selectedConfig.Mode == ConfigMode.DLL) { uri = "config/edit/metadata"; } else { uri = section switch { ConfigSection.Metadata => "config/edit/metadata", ConfigSection.Readme => "config/edit/readme", ConfigSection.Stacker => selectedConfig.Mode == ConfigMode.CSharp ? "config/edit/code" : "config/edit/stacker", ConfigSection.LoliCode => selectedConfig.Mode == ConfigMode.CSharp ? "config/edit/code" : "config/edit/lolicode", ConfigSection.Settings => "config/edit/settings", ConfigSection.CSharpCode => "config/edit/code", _ => throw new NotImplementedException() }; } VolatileSettings.DebuggerLog = new(); Nav.NavigateTo(uri); }
public static NavOperationViewModel ToNavOperationModel(this Nav entity) { return(entity.MapTo <Nav, NavOperationViewModel>()); }
public static void Render(Nav.ExploreCell cell, float radius, PointF trans, PaintEventArgs e, bool draw_connections, bool draw_id) { DrawRectangle(e.Graphics, Pens.Magenta, trans, cell.Min, cell.Max); //DrawString(e.Graphics, Brushes.Black, trans, cell.Position, Math.Round(cell.CellsArea()).ToString(), 14); if (cell.Explored) { //DrawLine(e.Graphics, explored_pen, trans, cell.Min, cell.Max); //DrawLine(e.Graphics, explored_pen, trans, new Vec3(cell.Min.X, cell.Max.Y), new Vec3(cell.Max.X, cell.Min.Y)); FillRectangle(e.Graphics, explored_brush, trans, cell.Min, cell.Max); } else { //DrawCircle(e.Graphics, Pens.Red, trans, cell.Position, radius); //DrawString(e.Graphics, Brushes.Black, trans, cell.Position, cell.UserData.ToString(), 10); if (draw_connections) foreach (Nav.Cell.Neighbour neighbour in cell.Neighbours) { ExploreCell neighbour_cell = (ExploreCell)neighbour.cell; DrawLine(e.Graphics, EXPLORE_CELL_CONNECTION_PEN, trans, cell.Position, neighbour_cell.Position); } if (draw_id) DrawString(e.Graphics, Brushes.Black, trans, cell.Position, cell.Id.ToString(), 10); } }
public Article(Nav nav) : base(nav) { PostType = PostType.Article; }
private void SubmitEditContract(MouseEventArgs args) { App.UpdateContract(Contract); Nav.NavigateTo("/"); }
public static NavViewModel ToModel(this Nav entity) { return(entity.MapTo <Nav, NavViewModel>()); }
static Task LoadFirstPage() => Nav.Go <Pages.Welcome>();
private async Task OnOpenFeedback() { await Nav.NavigateTo(new GiveFeedbackPage()); }
public static Task LoadFirstPage() => Nav.Go(new Pages.Page1());
public void SetUp() { BlogsTestConfig.Initialize(); nav = AdminManager.AddNav("test", "Test", "A nav for testing", BlogsTestConfig.BlogAppId); newTagId = BlogApp.AddTag(nav, "tag1", "tag one"); }
private async Task DoDeleteSession() { await Handler.DoDeleteSession(); Nav.NavigateTo("/host", forceLoad: true); }
public static void Render(Nav.GridCell cell, PointF trans, PaintEventArgs e, bool draw_connections, bool draw_id) { DrawRectangle(e.Graphics, Pens.Black, trans, cell.Min, cell.Max); if (draw_connections) foreach (Nav.Cell.Neighbour neighbour in cell.Neighbours) DrawLine(e.Graphics, GRID_CELL_CONNECTION_PEN, trans, cell.Center, neighbour.cell.Center); if (draw_id) DrawString(e.Graphics, Brushes.Black, trans, cell.Min, cell.Id.ToString(), 15); }
private void DeleteContract() { App.DeleteContract(Contract); Nav.NavigateTo("/"); }
public static void Render(Nav.Navmesh navmesh, Nav.ExploreCell cell, PointF trans, PaintEventArgs e, bool draw_id) { List<Nav.ExploreCell> all_cells = navmesh.Explorator.dbg_GetExploreCells(); foreach (ExploreCell other_cell in all_cells) { if (cell.Id == other_cell.Id) continue; DrawLine(e.Graphics, Pens.Gray, trans, cell.Position, other_cell.Position); DrawString(e.Graphics, Brushes.Black, trans, (cell.Position + other_cell.Position) * 0.5f, Math.Round(navmesh.Explorator.ExploreDistance(cell, other_cell)).ToString(), 8); } }
public NavBuilder <TModel> Begin(Nav nav) { return(new NavBuilder <TModel>(Html, nav)); }
public static IDisposable UxNav(this HtmlHelper htmlHelper, NavType type, bool justified = false, bool affix = false, int affixOffset = 0, string clientId = null) { var pager = new Nav(type, justified, affix, affixOffset, clientId); return RenderUxDispoableWebControl(htmlHelper, pager); }
public async Task Page3Tapped() => await Nav.Go <Pages.Page3>(PageTransition.Fade);
public void SetUp() { BlogsTestConfig.Initialize(); _nav = AdminManager.GetNav("tech"); }
public async Task ContactTapped() => await Nav.Go <Pages.Page4>(PageTransition.Fade);