/// <summary> /// Initializes the content components. /// </summary> private void InitializeContent() { DefaultContent InitialContent = new DefaultContent(Header.Week, wrapper); InitialContent.Finish += HandleMenuSelect; AddContent(InitialContent); AddContent(new CancelRequestController()); WorkflowInitializer.SetupSchedulingContent(wrapper, AddContent, WorkflowController); ContentController.ContentChanged += (object sender, ReferenceArgs <IInterfaceContent> args) => { if (args.Value is IComponent c) { Content.SetSelected(c); } OnHomeScreen.Value = args.Value.Name == "Default"; }; ContentController.Default = InitialContent.Name; ContentController.Activate(ContentController.Default); }
/** * <summary> * This event handler deletes a student from the db using EF * </summary> * * @method GamesGridView_RowDeleting * @param {object} sender * @param {GridViewDeleteEventArgs} e * @returns {void} */ protected void GamesGridView_RowDeleting(object sender, GridViewDeleteEventArgs e) { // store which row was clicked int selectedRow = e.RowIndex; // get the selected gameID using the Grid's DataKey collection int gameID = Convert.ToInt32(AllGamesGridView.DataKeys[selectedRow].Values["gameID"]); // use EF to find the selected student in the DB and remove it using (DefaultContent db = new DefaultContent()) { // create object of the Student class and store the query string inside of it baseballgametracker deletedGame = (from gameRecords in db.baseballgametrackers where gameRecords.gameID == gameID select gameRecords).FirstOrDefault(); // remove the selected game from the db db.baseballgametrackers.Remove(deletedGame); // save my changes back to the database db.SaveChanges(); // refresh the grid this.GetGames(); } }
private static string LoadEmbeddedShaderSource(string name) { using (Stream stream = DefaultContent.GetEmbeddedResourceStream(name)) using (StreamReader reader = new StreamReader(stream)) { return(reader.ReadToEnd()); } }
internal static void InitDefaultContent() { DefaultContent.InitType <FragmentShader>(".frag", stream => { using (StreamReader reader = new StreamReader(stream)) { string code = reader.ReadToEnd(); return(new FragmentShader(code)); } }); }
/** * <summary> * This method gets the game data from the DB * </summary> * * @method GetGames * @returns {void} */ protected void GetGames() { // connect to EF using (DefaultContent db = new DefaultContent()) { // query the Games Table using EF and LINQ var Games = (from allGames in db.baseballgametrackers select allGames); // bind the result to the GridView AllGamesGridView.DataSource = Games.AsQueryable().ToList(); AllGamesGridView.DataBind(); } }
internal static void InitDefaultContent() { DefaultContent.InitType <Material>(new Dictionary <string, Material> { { "SolidWhite", new Material(DrawTechnique.Solid, ColorRgba.White) }, { "SolidBlack", new Material(DrawTechnique.Solid, ColorRgba.Black) }, { "InvertWhite", new Material(DrawTechnique.Invert, ColorRgba.White) }, { "CoheeIcon", new Material(DrawTechnique.Mask, Texture.CoheeIcon) }, { "CoheeIconB", new Material(DrawTechnique.Mask, Texture.CoheeIconB) }, { "CoheeLogoBig", new Material(DrawTechnique.Alpha, Texture.CoheeLogoBig) }, { "CoheeLogoMedium", new Material(DrawTechnique.Alpha, Texture.CoheeLogoMedium) }, { "CoheeLogoSmall", new Material(DrawTechnique.Alpha, Texture.CoheeLogoSmall) }, { "Checkerboard", new Material(DrawTechnique.Solid, Texture.Checkerboard) }, }); }
internal static void InitDefaultContent() { DefaultContent.InitType <DrawTechnique>(new Dictionary <string, DrawTechnique> { { "Solid", new DrawTechnique(BlendMode.Solid) }, { "Mask", new DrawTechnique(BlendMode.Mask) }, { "Add", new DrawTechnique(BlendMode.Add) }, { "Alpha", new DrawTechnique(BlendMode.Alpha) }, { "Multiply", new DrawTechnique(BlendMode.Multiply) }, { "Light", new DrawTechnique(BlendMode.Light) }, { "Invert", new DrawTechnique(BlendMode.Invert) }, { "Picking", new DrawTechnique(BlendMode.Mask, VertexShader.Minimal, FragmentShader.Picking) }, { "SharpAlpha", new DrawTechnique(BlendMode.Alpha, VertexShader.Minimal, FragmentShader.SharpAlpha) } }); }
internal static void InitDefaultContent() { DefaultContent.InitType <Texture>(new Dictionary <string, Texture> { { "CoheeIcon", new Texture(Pixmap.CoheeIcon) }, { "CoheeIconB", new Texture(Pixmap.CoheeIconB) }, { "CoheeLogoBig", new Texture(Pixmap.CoheeLogoBig) }, { "CoheeLogoMedium", new Texture(Pixmap.CoheeLogoMedium) }, { "CoheeLogoSmall", new Texture(Pixmap.CoheeLogoSmall) }, { "White", new Texture(Pixmap.White) }, { "Checkerboard", new Texture( Pixmap.Checkerboard, TextureSizeMode.Default, TextureMagFilter.Nearest, TextureMinFilter.Nearest, TextureWrapMode.Repeat, TextureWrapMode.Repeat) }, }); }
protected void SaveButton_Click(object sender, EventArgs e) { // Use EF to connect to the server using (DefaultContent db = new DefaultContent()) { baseballgametracker newGame = new baseballgametracker(); int gameID = 0; if (Request.QueryString.Count > 0) // our URL has a GameID in it { // get the id from the URL gameID = Convert.ToInt32(Request.QueryString["gameID"]); // get the current game from EF DB newGame = (from game in db.baseballgametrackers where game.gameID == gameID select game).FirstOrDefault(); } // add form data to the new game newGame.homeTeamName = homeTeamName.Text; newGame.awayTeamName = awayTeamName.Text; newGame.homeScore = Convert.ToInt32(homeScore.Text); newGame.awayScore = Convert.ToInt32(awayScore.Text); newGame.description = description.Text; newGame.gameDate = Convert.ToDateTime(gameDateTextBox.Text); newGame.spectators = spectators.Text; // use LINQ to ADO.NET to add / insert new student into the database if (gameID == 0) { db.baseballgametrackers.Add(newGame); } // save our changes - also updates and inserts db.SaveChanges(); // Redirect back to the updated games view page Response.Redirect("~/ViewGames.aspx"); } }
internal static void InitDefaultContent() { IImageCodec codec = ImageCodec.GetRead(ImageCodec.FormatPng); if (codec == null) { Logs.Core.WriteError( "Unable to retrieve image codec for format '{0}'. Can't initialize default {1} Resources.", ImageCodec.FormatPng, typeof(Pixmap).Name); // Initialize default content with generic error instances, so // everything else can still work as expected. We logged the error, // and there's nothing anyone can do about this at runtime, so just // fail gracefully without causing more trouble. DefaultContent.InitType <Pixmap>(name => new Pixmap(new PixelData(1, 1, new ColorRgba(255, 0, 255)))); return; } DefaultContent.InitType <Pixmap>(".png", stream => new Pixmap(codec.Read(stream))); }
protected void GetGame() { int gameID = Convert.ToInt32(Request.QueryString["gameID"]); using (DefaultContent db = new DefaultContent()) { baseballgametracker updateGame = (from game in db.baseballgametrackers where game.gameID == gameID select game).FirstOrDefault(); // map the game properties to the form controls if (updateGame != null) { homeTeamName.Text = updateGame.homeTeamName; awayTeamName.Text = updateGame.awayTeamName; homeScore.Text = updateGame.homeScore.ToString(); awayScore.Text = updateGame.awayScore.ToString(); description.Text = updateGame.description; gameDateTextBox.Text = updateGame.gameDate.ToString(); spectators.Text = updateGame.spectators; } } }
/** * <summary> * This method querys the database and gets the game info * from the database and gets the games from the week * </summary> * */ protected void GetGames() { //get the sunday of the week of the game weekOfGame = GetFirstDayOfWeek(dateRange); //set the before date query DateTime before = weekOfGame.AddDays(7); //connect to the database using (DefaultContent db = new DefaultContent()) { //set up a query that selects only the proper date to load into the array IQueryable <baseballgametracker> games = from allgames in db.baseballgametrackers where allgames.gameDate <before where allgames.gameDate> weekOfGame select allgames; //set up gamesarray to put data into gamesArray = games.ToArray(); } }
private BookPageInfo[] PagesDefaultvalue() => DefaultContent?.Copy() ?? Array.Empty <BookPageInfo>();
private bool ShouldSerializePages() => DefaultContent?.IsMatch(_pages) != true;
public List<IPageSection> GetDefaultSectionContent(DefaultContent defaultContent) { return defaultContent?.Content?.Select(c => new PageSection() { Key = c.Section, Items = c.Items?.Select(i => new ContentItem() { Template = i, Values = new Dictionary<string, string>() }).ToList<IContentItem>() }).ToList<IPageSection>(); }