Using System; Using System.Collections; Using System.Collections.Generic; Using System.Globalization; Using System.Web; Using System.Xml; Using Ext.net; Namespace Extnettreepanlecustomcontrol { public class Composer { Public Composer (string name) {this. name = name; } public string Name {get; set;} private list<composition> compositions; Public list<composition> Compositions { Get { if (this.compositions = null) { This.compositions = new list<composition> (); } return this.compositions; } } } public class composition { Public composition () {} Public composition (Compositiontype type) { This. type = type; } Public Compositiontype Type {get; set;} Private list<piece> pieces; Public list<piece> Pieces { Get { if (this.pieces = null) { This.pieces = new list<piece> (); } return this.pieces; } } } public class Piece { Public Piece () {} Public Piece (string title) { This. title = title; } public string Title {get; set;} } public enum Compositiontype { Concertos, Quartets, Sonatas, Symphonies } public class MyData { public static list<composer> GetData () { Composer Beethoven = new Composer ("Beethoven"); Composition Beethovenconcertos = new composition (Compositiontype.concertos); Composition beethovenquartets = new composition (compositiontype.quartets); Composition Beethovensonatas = new composition (Compositiontype.sonatas); Composition beethovensymphonies = new composition (compositiontype.symphonies); BeethovenConcertos.Pieces.AddRange (New List<piece> { New piece{Title = "No. 1-c"}, New piece{Title = "No. 2-b-flat Major"}, New piece{Title = "No. 3-c Minor"}, New piece{Title = "No. 4-g Major"}, New piece{Title = "No. 5-e-flat Major"} }); BeethovenQuartets.Pieces.AddRange (New List<piece> { New piece{Title = "Six String Quartets"}, New piece{Title = "Three String Quartets"}, New piece{Title = "Grosse Fugue for String Quartets"} }); BeethovenSonatas.Pieces.AddRange (New List<piece> { New piece{Title = "Sonata in A Minor"}, New piece{Title = "Sonata in F Major"} }); BeethovenSymphonies.Pieces.AddRange (New List<piece> { New piece{Title = "No. 1-c Major"}, New piece{Title = "No. 2-d Major"}, New piece{Title = "No. 3-e-flat Major"}, New piece{Title = "No. 4-b-flat Major"}, New piece{Title = "No. 5-c Minor"}, New piece{Title = "No. 6-f Major"}, New piece{Title = "No. 7-a Major"}, New piece{Title = "No. 8-f Major"}, New piece{Title = "No. 9-d Minor"} }); Beethoven.Compositions.AddRange (New list<composition>{ Beethovenconcertos, Beethovenquartets, Beethovensonatas, Beethovensymphonies }); Composer Brahms = new Composer ("Brahms"); Composition Brahmsconcertos = new composition (Compositiontype.concertos); Composition brahmsquartets = new composition (compositiontype.quartets); Composition Brahmssonatas = new composition (Compositiontype.sonatas); Composition brahmssymphonies = new composition (compositiontype.symphonies); BrahmsConcertos.Pieces.AddRange (New List<piece> { New piece{Title = "Violin Concerto"}, New piece{Title = "Double concerto-a Minor"}, New piece{Title = "Piano Concerto No. 1-d Minor"}, New piece{Title = "Piano Concerto No. 2-b-flat Major"} }); BrahmsQuartets.Pieces.AddRange (New List<piece> { New piece{Title = "Piano quartet No. 1-g Minor"}, New piece{Title = "Piano quartet No. 2-a Major"}, New piece{Title = "Piano quartet No. 3-c Minor"}, New piece{Title = "Piano quartet No. 3-b-flat Minor"} }); BrahmsSonatas.Pieces.AddRange (New List<piece> { New piece{Title = "Two sonatas for Clarinet-f Minor"}, New piece{Title = "Two sonatas for Clarinet-e-flat Major"} }); BrahmsSymphonies.Pieces.AddRange (New List<piece> { New piece{Title = "No. 1-c Minor"}, New piece{Title = "No. 2-d Minor"}, New piece{Title = "No. 3-f Major"}, New piece{Title = "No. 4-e Minor"} }); Brahms.Compositions.AddRange (New list<composition>{ Brahmsconcertos, Brahmsquartets, Brahmssonatas, Brahmssymphonies }); Composer Mozart = new Composer ("Mozart"); Composition Mozartconcertos = new composition (Compositiontype.concertos); MozartConcertos.Pieces.AddRange (New List<piece> { New piece{Title = "Piano Concerto No. 12"}, New piece{Title = "Piano Concerto No. 17"}, New piece{Title = "Clarinet Concerto"}, New piece{Title = "Violin Concerto No. 5"}, New piece{Title = "Violin Concerto No. 4"} }); MOZART.COMPOSITIONS.ADD (Mozartconcertos); return new List<composer> {Beethoven, Brahms, Mozart}; } } } |