/// <summary> /// Initializes a new instance of the <see cref="SectionParserDefinitionViewModel"/> class. /// </summary> /// <param name="parent">The parent.</param> /// <param name="sectionParser">The section parser to use.</param> public SectionParserDefinitionViewModel(SectionDefinitionViewModel parent, ISectionParser sectionParser) : this() { Assertions.AssertNotNull(parent, "parent"); Assertions.AssertNotNull(sectionParser, "sectionParser"); _parent = parent; _parser = sectionParser; CreateOptionVMs(); }
/// <summary> /// Initializes a new instance of the <see cref="AreaDefinitionViewModel"/> class. /// </summary> /// <param name="parent">The parent.</param> public AreaDefinitionViewModel(SectionDefinitionViewModel parent) : this() { Assertions.AssertNotNull(parent, "parent"); _parent = parent; }
private void AddSectionCommand_Execute(object parameter) { SectionDefinitionViewModel section = new SectionDefinitionViewModel(this); Sections.Add(section); }
/// <summary> /// Loads the parser definition from a file. /// </summary> /// <param name="fileName">The file to load the parser definition from.</param> public void Load(string fileName) { Assertions.AssertNotEmpty(fileName, "fileName"); ControlInformation ci = ControlInformation.Load(fileName); // Clear all data this.Sections.Clear(); this.SelectedNode = null; // Fill in from the control file... this.ParserName = ci.FaxName; foreach (SectionDefinition sd in ci.Sections) { SectionDefinitionViewModel sdvm = new SectionDefinitionViewModel(this); sdvm.Name = sd.SectionString.String; foreach (SectionParserDefinition spd in sd.Parsers) { ISectionParser sectionParser = SectionParserCache.Create(spd.Type); sectionParser.OnLoad(spd.Options); SectionParserDefinitionViewModel spdvm = new SectionParserDefinitionViewModel(sdvm, sectionParser); sdvm.Aspects.Add(spdvm); } foreach (AreaDefinition ad in sd.Areas) { AreaDefinitionViewModel advm = new AreaDefinitionViewModel(sdvm); advm.Name = ad.AreaString.String; advm.MapToPropertyExpression = ad.MapToPropertyExpression; sdvm.Areas.Add(advm); } this.Sections.Add(sdvm); } }