예제 #1
0
        private void Apply()
        {
            _tournament.IsCreated = _isCreated;

            _tournament.Walllist.SortCriterion.Clear();
            foreach (var item in lvSortCriterion.Items)
            {
                var descr = item as SortCriterionDescriptior;
                if (descr.Active)
                {
                    var soDscr = new SortCriterionDescriptior()
                    {
                        Id = descr.Id
                    };
                    _tournament.Walllist.SortCriterion.Add(soDscr);
                }
            }

            _tournament.Walllist.Columns.Clear();
            foreach (var item in lvWallList.Items)
            {
                var descr = item as WallListMemberDescriptior;
                if (descr.Active)
                {
                    var member = new WallListMemberDescriptior()
                    {
                        Id = descr.Id
                    };
                    _tournament.Walllist.Columns.Add(member);
                }
            }

            if (OnResult != null)
            {
                OnResult(ReturnResult.Ok, _tournament);
            }
        }
예제 #2
0
        private void InitializeWallListMembers()
        {
            var members = new ObservableCollection <WallListMemberDescriptior>();

            List <Entity> entities = new List <Entity>();

            foreach (var item in _tournament.Walllist.Columns)
            {
                entities.Add(item.Id);
            }
            foreach (var item in _tournament.EntitiesMin)
            {
                if (!entities.Contains(item))
                {
                    entities.Add(item);
                }
            }
            foreach (var item in _tournament.EntitiesCriteria)
            {
                if (!entities.Contains(item))
                {
                    entities.Add(item);
                }
            }
            foreach (Entity item in Enum.GetValues(typeof(Entity)))
            {
                if (!entities.Contains(item) && !_tournament.EntitiesOutOfWallist.Contains(item))
                {
                    entities.Add(item);
                }
            }

            foreach (Entity it in entities)
            {
                if (members.FirstOrDefault(val => val != null && val.Id == it) == null &&
                    !_tournament.EntitiesCriteria.Contains(it))
                {
                    var member = new WallListMemberDescriptior()
                    {
                        Id = it
                    };
                    member.Enabled = true;
                    if (_tournament.Walllist.Columns.Find(item => item.Id == member.Id) != null)
                    {
                        member.Active = true;
                    }
                    if (_tournament.EntitiesMin.Contains(member.Id))
                    {
                        member.Active  = true;
                        member.Enabled = false;
                    }
                    if (_tournament.EntitiesHidden.Contains(it))
                    {
                        continue;
                    }

                    if (_tournament.EntitiesCriteria.Contains(it))
                    {
                        continue;
                    }

                    members.Add(member);
                }
            }

            this.lvWallList.ItemsSource = members;

            // This is all that you need to do, in order to use the ListViewDragManager.
            this.dragMgr = new ListViewDragDropManager <WallListMemberDescriptior>(this.lvWallList);

            // Turn the ListViewDragManager on and off.
            this.dragMgr.ListView = this.lvWallList;

            // Show and hide the drag adorner.
            this.dragMgr.ShowDragAdorner = true;

            // Hook up events on both ListViews to that we can drag-drop
            // items between them.
            this.lvWallList.DragEnter += OnListViewDragEnter;
            this.lvWallList.Drop      += OnListViewDrop;
        }
예제 #3
0
        private void InitializeWallListMembers()
        {
            var members = new ObservableCollection <WallListMemberDescriptior>();

            List <Entity> entities = new List <Entity>();

            foreach (var item in _tournament.Walllist.Columns)
            {
                entities.Add(item.Id);
            }
            foreach (var item in _tournament.EntitiesMin)
            {
                if (!entities.Contains(item))
                {
                    entities.Add(item);
                }
            }
            foreach (var item in _tournament.EntitiesCriteria)
            {
                if (!entities.Contains(item))
                {
                    entities.Add(item);
                }
            }
            foreach (Entity item in Enum.GetValues(typeof(Entity)))
            {
                if (!entities.Contains(item) && item != Entity.Num)
                {
                    entities.Add(item);
                }
            }

            foreach (Entity it in entities)
            {
                if (members.FirstOrDefault(val => val != null && val.Id == it) == null &&
                    !_tournament.EntitiesCriteria.Contains(it))
                {
                    var member = new WallListMemberDescriptior()
                    {
                        Id = it
                    };
                    member.Enabled = true;
                    if (_tournament.Walllist.Columns.Find(item => item.Id == member.Id) != null)
                    {
                        member.Active = true;
                    }
                    if (_tournament.EntitiesMin.Contains(member.Id))
                    {
                        member.Active  = true;
                        member.Enabled = false;
                    }
                    if (_tournament.EntitiesHidden.Contains(it))
                    {
                        continue;
                    }

                    if (_tournament.EntitiesCriteria.Contains(it))
                    {
                        continue;
                    }

                    members.Add(member);
                }
            }
        }