Esempio n. 1
0
        public void Add()
        {
            var xmlDoc = new XmlDocument(TestUtility.CreateDefaultNSM().NameTable);

            xmlDoc.LoadXml(
                $@"<rowItems xmlns=""http://schemas.openxmlformats.org/spreadsheetml/2006/main"" count=""3"">
				<i>
					<x v=""1""/>
				</i>
				<i r=""1"">
					<x v=""2""/>
				</i>
				<i r=""1"">
					<x v=""3""/>
				</i>
			</rowItems>"            );
            var node            = xmlDoc.FirstChild;
            var itemsCollection = new ItemsCollection(TestUtility.CreateDefaultNSM(), node);

            itemsCollection.Add(5, 3);
            Assert.AreEqual(4, itemsCollection.Count);
            Assert.AreEqual(4, node.ChildNodes.Count);
            Assert.AreEqual(5, itemsCollection[3].RepeatedItemsCount);
            Assert.AreEqual(1, itemsCollection[3].Count);
        }
Esempio n. 2
0
        protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
        {
            base.DeserializeCore(nodeElement, context);
            var wrapperName     = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_name");
            var wrapperSelected = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_selected");
            var wrapperIndex    = nodeElement.ChildNodes.Cast <XmlNode>().FirstOrDefault(x => x.Name == "listWrapper_index");

            if (wrapperName == null || wrapperSelected == null || wrapperIndex == null)
            {
                return;
            }
            if (wrapperName.Attributes == null || wrapperName.Attributes.Count <= 0)
            {
                return;
            }
            if (wrapperSelected.Attributes == null || wrapperSelected.Attributes.Count <= 0)
            {
                return;
            }
            if (wrapperIndex.Attributes == null || wrapperIndex.Attributes.Count <= 0)
            {
                return;
            }

            for (var i = 0; i <= wrapperName.Attributes.Count - 1; i++)
            {
                var name        = wrapperName.Attributes[i].Value;
                var selected    = wrapperSelected.Attributes[i].Value == "True";
                var index       = int.Parse(wrapperIndex.Attributes[i].Value);
                var itemWrapper = new ListItemWrapper {
                    Name = name, IsSelected = selected, Index = index
                };
                ItemsCollection.Add(itemWrapper);
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="combo"></param>
        /// <returns></returns>
        public object CreateGallery()
        {
            var g = PrimaryRibbonModel.CreateGallery();

            ItemsCollection.Add(g);
            return(g);
        }
Esempio n. 4
0
        /// <summary>
        /// Adds an item to the <see cref="T:System.Collections.IList" />.
        /// </summary>
        /// <param name="value">The <see cref="T:System.Object" /> to add to the <see cref="T:System.Collections.IList" />.</param>
        /// <returns>
        /// The position into which the new element was inserted.
        /// </returns>
        int IList.Add(object value)
        {
            TEntity _item = (TEntity)value;
            int     _ret  = GetIndex(_item);

            ItemsCollection.Add(_ret, _item);
            return(_ret);
        }
Esempio n. 5
0
        public void AddCollection(ClassificationButton btn)
        {
            //btn.Margin = new Thickness(2); ///////////////////////////////////////////////////////////
            //btn.Index = counter++;
            btn.ColectionParent = this;
            ItemsCollection.Add(btn);

            SetList();
        }
Esempio n. 6
0
 /// <summary>
 ///     Если контейнер не инициализирован, то на основании характеристик открывшего существа генерируется наполнение
 /// </summary>
 /// <param name = "_creature"></param>
 /// <returns></returns>
 public ItemsCollection GetItems(Creature _creature)
 {
     if (m_items == null)
     {
         m_items = new ItemsCollection();
         foreach (var item in GenerateItems(_creature))
         {
             if (item is IFaked)
             {
                 m_items.Add((Item)((IFaked)item).Essence.Clone(_creature));
             }
             else
             {
                 m_items.Add(item);
             }
         }
     }
     return(m_items);
 }
Esempio n. 7
0
		/// <summary>
		/// 	Если контейнер не инициализирован, то на основании характеристик открывшего существа генерируется наполнение
		/// </summary>
		/// <param name = "_creature"></param>
		/// <returns></returns>
		public ItemsCollection GetItems(Creature _creature)
		{
			if (m_items == null)
			{
				m_items = new ItemsCollection();
				foreach (var item in GenerateItems(_creature))
				{
					if (item is IFaked)
					{
						m_items.Add((Item) ((IFaked) item).Essence.Clone(_creature));
					}
					else
					{
						m_items.Add(item);
					}
				}
			}
			return m_items;
		}
Esempio n. 8
0
        private static void PrintGetGradesAndStudents()
        {
            var dictionary      = new ItemsCollection <Student>();
            var studentComparer = new ItemsCollection <Student> .StudentComparer();

            dictionary.Add("KG", new Student {
                FirstName = "John", LastName = "Smith", StudentId = 1
            }, studentComparer)
            .Add("KG", new Student {
                FirstName = "ZMary", LastName = "Smith", StudentId = 2
            }, studentComparer)
            .Add("KG", new Student {
                FirstName = "Mary", LastName = "Smith", StudentId = 3
            }, studentComparer)
            .Add("KG", new Student {
                FirstName = "Mary", LastName = "Smith", StudentId = 4
            }, studentComparer)
            .Add("KG", new Student {
                FirstName = "Mary", LastName = "Smith", StudentId = 5
            }, studentComparer);

            dictionary.Add("1st grade", new Student {
                FirstName = "Scott", LastName = "Allen", StudentId = 5
            },
                           studentComparer)
            .Add("1st grade", new Student {
                FirstName = "ZMary", LastName = "Allen", StudentId = 6
            }, studentComparer)
            .Add("1st grade", new Student {
                FirstName = "Mary", LastName = "Allen", StudentId = 7
            }, studentComparer);


            foreach (var grade in dictionary)
            {
                Console.WriteLine(grade.Key);
                foreach (var student in grade.Value)
                {
                    Console.WriteLine("\t" + student.FirstName);
                }
            }
        }
Esempio n. 9
0
 public CustomLabelProperties()
 {
     ItemsCollection.Add(new Items()
     {
         value = 10, label = "Min"
     });
     ItemsCollection.Add(new Items()
     {
         value = 100, label = "Max"
     });
 }
Esempio n. 10
0
 // TODO : Refactor and return something GO or ObservableComponent
 public virtual void AddItem(ObservableInfo newItem)
 {
     ItemsCollection.Add(newItem);
     if (!gameObject.activeInHierarchy)
     {
         return;
     }
     if (ListCount < maxListSize)
     {
         SpawnItem().GetComponent <ObservableComponent>().Info = newItem;
     }
 }
 public void AddItem(ListItemInfo newItem)
 {
     ItemsCollection.Add(newItem);
     if (!gameObject.activeInHierarchy)
     {
         return;
     }
     if (ListCount < maxListSize)
     {
         SpawnItem().GetComponent <ListItem>().ItemInfo = newItem;
     }
 }
Esempio n. 12
0
        private void Add(object param)
        {
            var ic = new InvoiceVatRate {
                Rate = ItemName, InvoiceVatRateId = Guid.NewGuid(), IsDeleted = false
            };

            ItemsCollection.Add(ic);

            commandBuffer.Add(new Helpers.CategoryCommand <InvoiceVatRate> {
                CommandType = Helpers.CommandEnum.Add, Item = ic
            });
        }
Esempio n. 13
0
 public static void InitializeColumns(this TablePanel gridPanel, IEnumerable <IGridColumn> columns, ItemsCollection <ColumnBase> columnModel)
 {
     foreach (var column in columns.Where(r => r.ShowInGrid))
     {
         var extColumn = column.CreateColumn();
         columnModel.Add(extColumn);
         if (column.HasChildren)
         {
             gridPanel.InitializeColumns(column.Children, extColumn.Columns);
         }
     }
 }
Esempio n. 14
0
        public ShellViewModel()
        {
            Title = "MN.Shell.MVVM sample application";

            ItemsCollection.Add(new CommandsSampleViewModel());
            ItemsCollection.Add(new SampleDocumentViewModel("Document 1"));
            ItemsCollection.Add(new SampleDocumentViewModel("Document 2"));

            ActivateItem(ItemsCollection[0]);

            Tool = new SampleToolViewModel();
        }
Esempio n. 15
0
        private void SelectItem(Property selectedItem)
        {
            var item = (PropertySetProperty)_entityFactory.CreateEntityForType("PropertySetProperty");

            item.PropertyId    = selectedItem.PropertyId;
            item.Property      = selectedItem;
            item.PropertySetId = InnerItem.PropertySetId;

            var maxPriority = ItemsCollection.InnerItems.Count == 0 ? 0 : ItemsCollection.InnerItems.Max(x => x.Priority);

            item.Priority = maxPriority + 1;

            ItemsCollection.Add(item);
        }
Esempio n. 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="selectedItems"></param>
        public void PopulateItems(IList selectedItems)
        {
            if (!InPorts.Any() || !InPorts[0].Connectors.Any())
            {
                return;
            }

            var owner      = InPorts[0].Connectors[0].Start.Owner;
            var index      = InPorts[0].Connectors[0].Start.Index;
            var mirrorName = owner.GetAstIdentifierForOutputIndex(index).Name;
            var mirror     = EngineController.GetMirror(mirrorName);

            var data = mirror?.GetData();

            if (data == null)
            {
                return;
            }

            if (data.IsCollection)
            {
                var counter = 0;
                foreach (var item in data.GetElements())
                {
                    var i       = item.Data;
                    var wrapper = new ListItemWrapper
                    {
                        Name  = i.ToString(),
                        Index = counter
                    };

                    var existing = ItemsCollection.IndexOf(wrapper);
                    if (existing != -1)
                    {
                        ItemsCollection[existing].IsSelected = selectedItems.Contains(wrapper);
                    }
                    else
                    {
                        ItemsCollection.Add(wrapper);
                    }

                    counter++;
                }
            }
        }
Esempio n. 17
0
        public static void Import(this ItemsCollection items, string filename, bool replace = false)
        {
            var bps = LoadFromFile <List <BlueprintItem> >(filename);

            if (bps != null)
            {
                if (replace)
                {
                    var doomed = items.Items.Where <ItemEntity>(x => x.HoldingSlot == null).ToTempList <ItemEntity>();
                    foreach (var toDie in doomed)
                    {
                        items.Remove(toDie);
                    }
                }
                foreach (var bp in bps)
                {
                    items.Add(bp);
                }
            }
        }
Esempio n. 18
0
 private void createSubMenu(ItemsCollection <Component> itemsCollection, DataTable dt, string p)
 {
     DataRow[] rows = dt.Select("parentid='" + p + "'");
     foreach (DataRow row in rows)
     {
         sysprog          prog = ConvertHelper.RowToObject <sysprog>(row);
         Ext.Net.MenuItem menu = new Ext.Net.MenuItem(prog.ProgName);
         if (prog.IsGroup == "1")
         {
             menu.Icon = Icon.Folder;
             createSubMenu(menu.Menu, dt, prog.id);
         }
         else
         {
             menu.Icon = Icon.World;
             //menu.ID = prog.id;
             menu.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');";
         }
         itemsCollection.Add(menu);
     }
 }
        private void SetCurrent(SalesOrder current)
        {
            if (current == null)
            {
                if (CurrentItem == null)
                {
                    return;
                }
                ItemsCollection.Remove(CurrentItem);
                return;
            }
            var index = ItemsCollection.IndexOf(current);

            if (index >= 0)
            {
                ItemsCollection[index] = current;
            }
            else
            {
                ItemsCollection.Add(current);
            }
            ChangeCurrentItem(current);
        }
Esempio n. 20
0
        private void __BuildControl__control16(ItemsCollection <AbstractComponent> __ctrl)
        {
            TextField field = this.__BuildControltxtUsername();

            __ctrl.Add(field);
            TextField field2 = this.__BuildControltxtPassword();

            __ctrl.Add(field2);
            TextField field3 = this.__BuildControltxtVerifyCode();

            __ctrl.Add(field3);
            Ext.Net.Image image = this.__BuildControlimgVerify();
            __ctrl.Add(image);
            DisplayField field4 = this.__BuildControl__control17();

            __ctrl.Add(field4);
            Ext.Net.LinkButton button = this.__BuildControlbtnChangeImage();
            __ctrl.Add(button);
        }
Esempio n. 21
0
 /// <inheritdoc />
 public void AddItem(object o)
 {
     ItemsCollection.Add(o);
 }
Esempio n. 22
0
 private void __BuildControl__control12(ItemsCollection<AbstractComponent> __ctrl)
 {
     FormPanel panel = this.__BuildControl__control13();
     __ctrl.Add(panel);
 }
Esempio n. 23
0
 private void __BuildControl__control18(ItemsCollection<ButtonBase> __ctrl)
 {
     Ext.Net.Button button = this.__BuildControlbtnLogin();
     __ctrl.Add(button);
 }
Esempio n. 24
0
 private void _service_Xaq(string obj)
 {
     ItemsCollection.Add(obj);
 }
Esempio n. 25
0
 private void __BuildControl__control18(ItemsCollection <ButtonBase> __ctrl)
 {
     Ext.Net.Button button = this.__BuildControlbtnLogin();
     __ctrl.Add(button);
 }
Esempio n. 26
0
 /// <inheritdoc />
 public void AddItem(object item)
 {
     ItemsCollection.Add(item);
 }
Esempio n. 27
0
        private void __BuildControl__control12(ItemsCollection <AbstractComponent> __ctrl)
        {
            FormPanel panel = this.__BuildControl__control13();

            __ctrl.Add(panel);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="contentControls"></param>
        /// <param name="contentItems"></param>
        protected virtual void PopulateItems(ControlCollection contentControls, ItemsCollection<AbstractComponent> contentItems)
        {
            foreach (Control control in contentControls)
            {
                AbstractComponent cmp = control as AbstractComponent;

                if (cmp != null)
                {
                    contentItems.Add(cmp);
                    cmp.ID = cmp.ID;
                }
                else if (control is ContentPlaceHolder || control is UserControl)
                {
                    this.PopulateItems(control.Controls, contentItems);
                }
                else if(control is LiteralControl || control is Literal)
                {
                    continue;
                }
                else
                {
                    throw new Exception(string.Format(ServiceMessages.NON_LAYOUT_CONTROL, control.GetType().ToString()));
                }
            }
        }
Esempio n. 29
0
 public override void Create(Match item)
 {
     ItemsCollection.Add(item);
 }
Esempio n. 30
0
 private void __BuildControl__control16(ItemsCollection<AbstractComponent> __ctrl)
 {
     TextField field = this.__BuildControltxtUsername();
     __ctrl.Add(field);
     TextField field2 = this.__BuildControltxtPassword();
     __ctrl.Add(field2);
     TextField field3 = this.__BuildControltxtVerifyCode();
     __ctrl.Add(field3);
     Ext.Net.Image image = this.__BuildControlimgVerify();
     __ctrl.Add(image);
     DisplayField field4 = this.__BuildControl__control17();
     __ctrl.Add(field4);
     Ext.Net.LinkButton button = this.__BuildControlbtnChangeImage();
     __ctrl.Add(button);
 }
Esempio n. 31
0
 private void createSubMenu(ItemsCollection<Component> itemsCollection, DataTable dt, string p)
 {
     DataRow[] rows = dt.Select("parentid='" + p + "'");
     foreach (DataRow row in rows) {
         sysprog prog = ConvertHelper.RowToObject<sysprog>(row);
         Ext.Net.MenuItem menu = new Ext.Net.MenuItem(prog.ProgName);
         if (prog.IsGroup == "1") {
             menu.Icon = Icon.Folder;
             createSubMenu(menu.Menu, dt, prog.id);
         } else {
             menu.Icon = Icon.World;
             //menu.ID = prog.id;
             menu.Listeners.Click.Handler = "showmodule(#{MyDesktop},'" + prog.id + "');";
         }
         itemsCollection.Add(menu);
     }
 }
Esempio n. 32
0
 /// <summary>
 /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" />.
 /// </summary>
 /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1" />.</param>
 public void Add(TEntity item)
 {
     ItemsCollection.Add(GetIndex(item), item);
 }