// Load data from various files public void LoadFiles(PatternCategory category, string sPath) { string sBase; RichTextBox rtf = new RichTextBox(); foreach (Pattern p in Patterns(category)) { sBase = Path.Combine(sPath, p.Name); p.Diagram = Image.FromFile(sBase + ".gif"); List <string> section = LoadSections(sBase + ".txt"); p.Definition = section[0]; p.StructuralCodeIntro = section[1]; p.RealWorldCodeIntro = section[2]; p.OptimizedCodeIntro = section[3]; rtf.LoadFile(sBase + ".rtf"); p.Participants = rtf.Rtf; } }
// Get patterns by category public IEnumerable <Pattern> Patterns(PatternCategory category) { return(from p in Items where p.Category == category select p); }