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 Load(Stream stream) { XmlReaderSettings settings = new XmlReaderSettings() { CheckCharacters = false, CloseInput = false }; using (XmlReader reader = XmlReader.Create(stream, settings)) return(WindowProfile.LoadInternal(reader)); }
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); }
public static View Create(WindowProfile owningProfile, string name, Type viewType) { if (owningProfile == null) { throw new ArgumentNullException("owningProfile"); } View view = ViewElementFactory.Current.CreateView(viewType); View.Initialize(view, owningProfile, name); return(view); }
public static View Create(WindowProfile owningProfile, string name) { if (owningProfile == null) { throw new ArgumentNullException("owningProfile"); } View view = View.Create(); View.Initialize(view, owningProfile, name); return(view); }
public void RemoveAllFloats(WindowProfile profile) { foreach (ViewElement viewElement in (IEnumerable <ViewElement>)profile.Children) { FloatSite floatSite = viewElement as FloatSite; if (floatSite != null) { this.RemoveFloat(floatSite); } } }
public static WindowProfile Load(string profileXml) { using (StringReader stringReader = new StringReader(profileXml)) { XmlReaderSettings settings = new XmlReaderSettings() { CheckCharacters = false, CloseInput = false }; using (XmlReader reader = XmlReader.Create((TextReader)stringReader, settings)) return(WindowProfile.LoadInternal(reader)); } }
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(); }
private void DeleteExtraMainSites(List <MainSite> mainSites, WindowProfile profile) { MainSite mainSite1 = (MainSite)null; int num = 0; foreach (MainSite mainSite2 in mainSites) { List <ViewElement> list = new List <ViewElement>(mainSite2.FindAll((Predicate <ViewElement>)(v => v != null))); if (mainSite1 == null || list.Count > num) { mainSite1 = mainSite2; num = list.Count; } } mainSites.Remove(mainSite1); foreach (MainSite mainSite2 in mainSites) { profile.Children.Remove((ViewElement)mainSite2); } mainSites.Clear(); mainSites.Add(mainSite1); }
public WindowProfileElementCollection(WindowProfile windowProfile) { this.WindowProfile = windowProfile; }
public WindowProfileChangingEventArgs(WindowProfile oldProfile, WindowProfile newProfile) { this.OldWindowProfile = oldProfile; this.NewWindowProfile = newProfile; }
private static void Initialize(View view, WindowProfile owningProfile, string name) { view.Name = name; DockOperations.Float((ViewElement)view, owningProfile); }