public void Validate(WindowProfile profile) { List <MainSite> mainSites = new List <MainSite>(); for (int index = 0; index < profile.Children.Count; ++index) { ViewElement element = profile.Children[index]; if (element is MainSite) { mainSites.Add(element as MainSite); } if (!(!(element is ViewGroup) ? this.ValidateElement(element) : this.ValidateGroup(element as ViewGroup))) { profile.Children.Remove(element); --index; } } if (mainSites.Count == 0) { MainSite mainSite = MainSite.Create(); mainSite.Child = WindowProfile.CreateDefaultMainSiteContent(); profile.Children.Add((ViewElement)mainSite); } else { if (mainSites.Count > 1) { this.DeleteExtraMainSites(mainSites, profile); } foreach (MainSite site in mainSites) { this.PostValidation(site); } } }
public static WindowProfile Create(string profileName) { MainSite mainSite = MainSite.Create(); mainSite.Child = WindowProfile.CreateDefaultMainSiteContent(); WindowProfile windowProfile = new WindowProfile(); windowProfile.Name = profileName; windowProfile.Children.Add((ViewElement)mainSite); return(windowProfile); }
private void PostValidation(MainSite site) { if (site.Find((Predicate <ViewElement>)(v => { if (!(v is DocumentGroup)) { return(v is NakedView); } return(true); })) != null) { return; } site.Child = WindowProfile.CreateDefaultMainSiteContent(); }