public CreditsWindowBuilder AddContribution(AppContribution contribution) { if (this.contributions.Count > 0) { AppContribution last = this.contributions.Last(); if (contribution.DateTime.CompareTo(last.DateTime) < 0) { string message = "Illegal contribution ordering: contribution " + contribution + " must be specified before " + last; ErrorReporter.ReportParadox(message); throw new Exception(message); } } this.contributions.Add(contribution); return(this); }
private LayoutChoice_Set MakeSublayout(AppContribution contribution) { // get some properties AppContributor who = contribution.Contributor; string name = who.Name; string when = contribution.DateTime.ToString("yyyy-MM-dd"); string description = contribution.Description; double fontSize = 16; double nameSize = 30; // build the name button layout LayoutChoice_Set nameLayout; if (who.Email != null || who.Website != null) { // If this contributor provided details, then make a button to show those details Vertical_GridLayout_Builder detailBuilder = new Vertical_GridLayout_Builder(); detailBuilder.AddLayout(new TextblockLayout("Contributor Name: " + name, fontSize)); if (who.Email != null) { detailBuilder.AddLayout(new TextblockLayout("Email: " + who.Email, fontSize)); } if (who.Website != null) { detailBuilder.AddLayout(new TextblockLayout("Website: " + who.Website, fontSize)); } nameLayout = new HelpButtonLayout(name, detailBuilder.Build(), layoutStack, nameSize); } else { // If this contributor didn't provide details, then just display their name TextblockLayout l = new TextblockLayout(name, nameSize); l.AlignHorizontally(TextAlignment.Center); nameLayout = l; } // build the rest of the layout Vertical_GridLayout_Builder fullBuilder = new Vertical_GridLayout_Builder(); fullBuilder.AddLayout(nameLayout); fullBuilder.AddLayout(new TextblockLayout("On " + when + ": " + description, fontSize)); fullBuilder.AddLayout(new TextblockLayout("Thanks!", fontSize)); return(fullBuilder.Build()); }
public CreditsButtonBuilder AddContribution(AppContribution contribution) { this.contentBuilder.AddContribution(contribution); return(this); }