Exemplo n.º 1
0
        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);
                }
            }
        }
Exemplo n.º 2
0
        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));
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
 public void RemoveAllFloats(WindowProfile profile)
 {
     foreach (ViewElement viewElement in (IEnumerable <ViewElement>)profile.Children)
     {
         FloatSite floatSite = viewElement as FloatSite;
         if (floatSite != null)
         {
             this.RemoveFloat(floatSite);
         }
     }
 }
Exemplo n.º 7
0
 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));
     }
 }
Exemplo n.º 8
0
 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();
 }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 public WindowProfileElementCollection(WindowProfile windowProfile)
 {
     this.WindowProfile = windowProfile;
 }
 public WindowProfileChangingEventArgs(WindowProfile oldProfile, WindowProfile newProfile)
 {
     this.OldWindowProfile = oldProfile;
     this.NewWindowProfile = newProfile;
 }
Exemplo n.º 12
0
 private static void Initialize(View view, WindowProfile owningProfile, string name)
 {
     view.Name = name;
     DockOperations.Float((ViewElement)view, owningProfile);
 }