Exemplo n.º 1
0
        public void UpdateItemGroups()
        {
            //create our groups
            var groups    = new List <ItemGroupVM>();
            var enumNames = Enum.GetNames(typeof(ItemCategories));

            Array.Sort <String>(enumNames);

            //check enum support
            foreach (string ename in enumNames)
            {
                var etype = Enum.Parse(typeof(ItemCategories), ename);
                int eint  = (int)etype;
                if (((int)_categories & eint) == eint)
                {
                    //create the group for this supported type
                    ItemGroupVM vm = new ItemGroupVM(ename, this);
                    if (vm.Items.Count > 0)
                    {
                        groups.Add(vm);
                    }
                }
            }

            AllGroups = new UpdatableCollection <ItemGroupVM>(groups);
            OnPropertyChanged("AllGroups");
        }
Exemplo n.º 2
0
        public ItemSlotVM(CharacterVM character, AmfObject obj, ItemCategories categories)
            : base(obj)
        {
            Categories = categories;
            _character = character;

            //find the xml definition for this slot type
            var id = GetString("classInstance");

            _xml = XmlItem.Empty;
            foreach (XmlItem item in XmlData.Current.Items)
            {
                if (item.ID == id)
                {
                    _xml = item;
                    break;
                }
            }

            //create our groups
            var groups    = new List <ItemGroupVM>();
            var enumNames = Enum.GetNames(typeof(ItemCategories));

            Array.Sort <String>(enumNames);

            //check enum support
            foreach (string ename in enumNames)
            {
                var etype = Enum.Parse(typeof(ItemCategories), ename);
                int eint  = (int)etype;
                if (((int)categories & eint) == eint)
                {
                    //create the group for this supported type
                    ItemGroupVM vm = new ItemGroupVM(ename, this);
                    if (vm.Items.Count > 0)
                    {
                        groups.Add(vm);
                    }
                }
            }

            AllGroups = new UpdatableCollection <ItemGroupVM>(groups);
        }
Exemplo n.º 3
0
        public void UpdateItemGroups()
        {
            //create our groups
            var groups = new List <ItemGroupVM>();
            //var enumNames = Enum.GetNames(typeof(ItemCategories));
            var typeNames = Types;

            typeNames.Sort();

            //check enum support
            foreach (string typeName in typeNames)
            {
                ItemGroupVM vm = new ItemGroupVM(typeName, this);
                if (vm.Items.Count > 0)
                {
                    groups.Add(vm);
                }
            }

            AllGroups = new UpdatableCollection <ItemGroupVM>(groups);
            OnPropertyChanged("AllGroups");
        }