Пример #1
0
        public void EntityListView_ShowEntitiesFromWorld()
        {
            m_Manager.CreateEntity();
            var emptySystem   = World.GetOrCreateSystem <EmptySystem>();
            var selectedWorld = World;
            ComponentSystemBase currentSystem = null;

            using (var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, () => selectedWorld,
                                                     () => currentSystem, x => {}))
            {
                // TODO EntityManager is no longer a system

                /*
                 * currentSystem = World.Active.EntityManager;
                 * listView.SelectedEntityQuery = AllQuery;
                 * Assert.IsTrue(listView.ShowingSomething);
                 * Assert.AreEqual(1, listView.GetRows().Count);
                 *
                 * currentSystem = World.Active.EntityManager;
                 * listView.SelectedEntityQuery = null;
                 * Assert.IsTrue(listView.ShowingSomething);
                 * Assert.AreEqual(1, listView.GetRows().Count);
                 */

                currentSystem = emptySystem;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);
            }
        }
Пример #2
0
        public void EntityListView_ShowNothingWithoutWorld()
        {
            m_Manager.CreateEntity();
            var emptySystem = World.Active.GetOrCreateManager <EmptySystem>();
            ScriptBehaviourManager currentSystem = null;

            using (var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, () => null,
                                                     () => currentSystem, x => {}))
            {
                currentSystem = World.Active.GetExistingManager <EntityManager>();
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);

                currentSystem = emptySystem;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);

                currentSystem = null;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);

                currentSystem = null;
                listView.SelectedEntityQuery = AllQuery;
                Assert.IsFalse(listView.ShowingSomething);
            }
        }
Пример #3
0
        public void EntityListView_ShowEntitiesFromWorld()
        {
            m_Manager.CreateEntity();
            var emptySystem   = World.Active.GetOrCreateManager <EmptySystem>();
            var selectedWorld = World.Active;
            ScriptBehaviourManager currentSystem = null;

            using (var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, () => selectedWorld,
                                                     () => currentSystem, x => {}))
            {
                currentSystem = World.Active.GetExistingManager <EntityManager>();
                listView.SelectedEntityQuery = AllQuery;
                Assert.IsTrue(listView.ShowingSomething);
                Assert.AreEqual(1, listView.GetRows().Count);

                currentSystem = World.Active.GetExistingManager <EntityManager>();
                listView.SelectedEntityQuery = null;
                Assert.IsTrue(listView.ShowingSomething);
                Assert.AreEqual(1, listView.GetRows().Count);

                currentSystem = emptySystem;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);
            }
        }
Пример #4
0
        /// <summary>
        /// Updates this entity view with appropriate data. WinForms API lacks
        /// the ability to dynamically bind to a data set so this will have to do.
        /// </summary>
        /// <param name="entities">The entity list from the map you want to view.</param>
        public void UpdateList(List <Entity> entities, List <Layer> layers)
        {
            _entities = entities;
            _layers   = layers;
            EntityListView.Items.Clear();
            EntityListView.BeginUpdate();
            EntityListView.SmallImageList = new ImageList();
            int num = 0, triggers = 0;

            foreach (var entity in entities)
            {
                string name = "", type = "";
                if (entity.Type == Entity.EntityType.Trigger)
                {
                    triggers++;
                    name = $"Trigger: {triggers}";
                    type = "Trigger";
                }
                else if (entity.Type == Entity.EntityType.Person)
                {
                    name = entity.Name;
                    type = "Person";
                }

                var item = new ListViewItem(name);
                item.Tag = entity;
                item.SubItems.Add(entity.Layer.ToString());
                item.SubItems.Add(type);
                EntityListView.Items.Add(item);
                EntityListView.SmallImageList.Images.Add(entity.Image);
                item.ImageIndex = num++;
            }
            EntityListView.EndUpdate();
        }
Пример #5
0
 public RibbonGalleryBar(WorkItem workItem, EntityListView contentView, string entityName)
 {
     this.Name       = "FilterGalleryBar";
     _workItem       = workItem;
     _view           = contentView;
     _entityGridView = contentView.EntityGridView;
     _entityName     = entityName;
 }
Пример #6
0
        private EntityListViewDTO ToEntityListViewDTO(DR_Requester requester, EntityListView item, bool withDetails)
        {
            EntityListViewDTO result = new EntityListViewDTO();

            result.TableDrivedEntityID = item.TableDrivedEntityID;
            result.ID    = item.ID;
            result.Title = item.Title;
            if (withDetails)
            {
                BizColumn bizColumn = new MyModelManager.BizColumn();
                foreach (var column in item.EntityListViewColumns)
                {
                    EntityListViewColumnsDTO rColumn = new EntityListViewColumnsDTO();
                    rColumn.ID            = column.ID;
                    rColumn.ColumnID      = column.ColumnID;
                    rColumn.Column        = bizColumn.ToColumnDTO(column.Column, true);
                    rColumn.IsDescriptive = column.IsDescriptive;
                    rColumn.Alias         = column.Alias ?? rColumn.Column.Alias ?? rColumn.Column.Name;
                    rColumn.OrderID       = column.OrderID ?? 0;
                    if (column.EntityRelationshipTailID != null)
                    {
                        rColumn.RelationshipTailID = column.EntityRelationshipTailID.Value;
                        rColumn.RelationshipTail   = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(column.EntityRelationshipTail);
                    }
                    if (!string.IsNullOrEmpty(column.Tooltip))
                    {
                        rColumn.Tooltip = column.Tooltip;
                    }
                    else
                    {
                        if (rColumn.RelationshipTail != null)
                        {
                            rColumn.Tooltip = rColumn.RelationshipTail.ReverseRelationshipTail.TargetEntityAlias + "." + rColumn.Column.Alias;
                        }
                    }
                    rColumn.WidthUnit = column.WidthUnit ?? 0;

                    //rColumn.RelativeColumnName = rColumn.Column.Name + rColumn.RelationshipTailID.ToString();
                    result.EntityListViewAllColumns.Add(rColumn);
                }
                //foreach (var tail in item.EntityListViewRelationshipTails)
                //{
                //    EntityListViewRelationshipTailDTO rTail = new EntityListViewRelationshipTailDTO();
                //    rTail.ID = tail.ID;
                //    rTail.EntityRelationshipTailID = tail.EntityRelationshipTailID;
                //    rTail.EntityRelationshipTail = bizEntityRelationshipTail.ToEntityRelationshipTailDTO(tail.EntityRelationshipTail);
                //    foreach (var tailColumn in tail.EntityListViewColumns)
                //    {
                //        rTail.EntityListViewColumns.Add(result.EntityListViewAllColumns.First(x => x.ID == tailColumn.ID));
                //    }
                //    result.EntityListViewRelationshipTails.Add(rTail);
                //}
            }

            ImposeSecurity(requester, result, item.TableDrivedEntity);
            return(result);
        }
Пример #7
0
        private bool DataIsAccessable(DR_Requester requester, EntityListView entityListView)
        {
            if (requester.SkipSecurity)
            {
                return(true);
            }

            return(bizTableDrivedEntity.DataIsAccessable(requester, entityListView.TableDrivedEntity));
        }
Пример #8
0
 public void EntityListView_ShowNothingWithNoEntityManager()
 {
     using (var incompleteWorld = new World("test 2"))
     {
         using (var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, () => incompleteWorld,
                                                  () => null, x => {}))
         {
             listView.SelectedEntityQuery = null;
             Assert.AreEqual(0, listView.GetRows().Count);
         }
     }
 }
Пример #9
0
        public void EntityListView_ShowNothingWithoutWorld()
        {
            m_Manager.CreateEntity();
            var emptySystem = World.GetOrCreateSystem <EmptySystem>();
            ComponentSystemBase currentSystem = null;

            using (var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, () => null,
                                                     () => currentSystem, x => {}))
            {
                currentSystem = emptySystem;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);

                currentSystem = null;
                listView.SelectedEntityQuery = null;
                Assert.IsFalse(listView.ShowingSomething);

                currentSystem = null;
                listView.SelectedEntityQuery = AllQuery;
                Assert.IsFalse(listView.ShowingSomething);
            }
        }
Пример #10
0
        public void SetGridView(EntityListView contentView, string fileName, string filterName, string filterString)
        {
            _currentView = contentView.EntityGridView;
            _view        = contentView;
            SetFontSizeAndName();
            formatConditionBindingSource.Clear();
            FilterCondition condtion = new FilterCondition();

            if (fileName != "")
            {
                condtion.FilteName  = filterName;
                condtion.Name       = fileName;
                condtion.Conditions = filterString;
            }
            else
            {
                condtion.FilteName = "Untitled";
            }

            int position = formatConditionBindingSource.Add(condtion);

            formatConditionBindingSource.Position = position;
        }
Пример #11
0
 private void CreateEntityListView()
 {
     entityListView = EntityListView.CreateGroupListView(() => GetSelectionGroup(), m => SetEntitySelection(m));
 }
Пример #12
0
        public void EntityListView_CanSetNullGroup()
        {
            var listView = new EntityListView(new TreeViewState(), null, SetEntitySelection, GetWorldSelection);

            Assert.DoesNotThrow(() => listView.SelectedComponentGroup = null);
        }