Ejemplo n.º 1
0
        public void UnionLayoutList()
        {
            LayoutInfo layout1 = new LayoutInfo()
            {
                Id = "vlarf"
            };

            LayoutInfo layout2 = new LayoutInfo()
            {
                Id = "test"
            };

            LayoutInfo layout3 = new LayoutInfo()
            {
                Id = "today"
            };

            LayoutList list1 = new LayoutList();

            list1.Add(layout1);
            list1.Add(layout2);

            LayoutList list2 = new LayoutList();

            list2.Add(layout1);
            list2.Add(layout3);

            var union = list1.AsEnumerable().Union(list2.AsEnumerable());

            Assert.NotNull(union);
        }
        /// <summary>
        /// Convert an IEnumerable to a LayoutList
        /// </summary>
        /// <param name="layouts">A list of LayoutInfo objects.</param>
        /// <returns>A LayoutList</returns>
        public static LayoutList ToLayoutList(this IEnumerable <LayoutInfo> layouts)
        {
            LayoutList result = new LayoutList();

            foreach (var layout in layouts)
            {
                if (layout.IsValid())
                {
                    var parent = layout.Parent;
                    result.Add(layout);
                    result.Last().Parent = parent;
                }
            }

            return(result);
        }
        /// <summary>
        /// Convert an IEnumerable to a LayoutList
        /// </summary>
        /// <param name="layouts">A list of LayoutInfo objects.</param>
        /// <param name="parent">A ConcernInfo object.</param>
        /// <returns>A LayoutList</returns>
        public static LayoutList ToLayoutList(
            this IEnumerable <LayoutInfo> layouts,
            ConcernInfo parent)
        {
            var result = new LayoutList();

            if (parent.IsValid())
            {
                foreach (var layout in layouts)
                {
                    if (layout.IsValid())
                    {
                        result.Add(layout);
                        result.Last().Parent = parent;
                    }
                }
            }

            return(result);
        }
 //////////////////////////////////////////////////////////////////////////
 public PolishKeyboardLayout()
 {
     Name = "Polish";
     LayoutList.Clear();
     LayoutList.Add(1045);
 }
 //////////////////////////////////////////////////////////////////////////
 public GermanKeyboardLayout()
 {
     Name = "German";
     LayoutList.Clear();
     LayoutList.Add(1031);
 }
 //////////////////////////////////////////////////////////////////////////
 public CzechKeyboardLayout()
 {
     Name = "Czech";
     LayoutList.Clear();
     LayoutList.Add(1029);
 }
 //////////////////////////////////////////////////////////////////////////
 public ThaiKeyboardLayout()
 {
     Name = "Thai";
     LayoutList.Clear();
     LayoutList.Add(1054);
 }