public EntitiesControl() { InitializeComponent(); Entities = new EntityTreeViewModel(this); DataContext = Entities; Entities.Init(); }
public EntitiesControl() { InitializeComponent(); Entities = new EntityTreeViewModel(this); DataContext = Entities; Entities.Init(); SortCombo.ItemsSource = Enum.GetNames(typeof(EntityTreeViewModel.SortEnum)); }
public async Task <IHttpActionResult> UpdateEntity([FromBody] EntityTreeViewModel entityTreeViewModel) { return(await HttpActionResultWithErrorHandling(SecurityActions.ManageEntities, async() => { var updatedEntity = await _adminRepo.UpdateEntity(entityTreeViewModel); addOrDeleteEntityTypes(entityTreeViewModel); var updatedViewModel = Mapper.Map <EntityTreeViewModel>(updatedEntity); return Json(true); })); }
public async Task <IHttpActionResult> DeleteEntity([FromBody] EntityTreeViewModel entityTreeViewModel) { return(await HttpActionResultWithErrorHandling(SecurityActions.ManageEntities, async() => { var result = await _adminRepo.DeleteEntity(entityTreeViewModel.EntityId); //Don't need add new value for the function entityTreeViewModel.EntityTypeProperties = null; addOrDeleteEntityTypes(entityTreeViewModel); return Json(result); })); }
public GridViewModel(MyCubeGrid grid, EntityTreeViewModel tree) : base(grid, tree) { TorchBase.Instance.InvokeBlocking(() => { foreach (var block in grid.GetFatBlocks().Where(b => b is IMyTerminalBlock)) { Blocks.Add(new BlockViewModel((IMyTerminalBlock)block, tree)); } }); Blocks.Sort(b => b.Block.GetType().AssemblyQualifiedName); grid.OnBlockAdded += Grid_OnBlockAdded; grid.OnBlockRemoved += Grid_OnBlockRemoved; }
public async Task <IHttpActionResult> AddEntity([FromBody] EntityTreeViewModel entityTreeViewModel) { return(await HttpActionResultWithErrorHandling(SecurityActions.ManageEntities, async() => { var entityType = _adminRepo.GetEntityTypes().FirstOrDefault(t => t.Id == entityTreeViewModel.EntityTypeId); if (entityType != null) { entityTreeViewModel.EntityTypeName = entityType.Name; } var entity = new Entity { TenantId = Tenant.Id, EntityName = entityTreeViewModel.EntityName, EntityType = entityType //TODO: EntityProperties }; _adminRepo.AddEntity(entity); var entityTree = new EntityTree { TenantId = entity.TenantId, Entity = entity, EntityId = entity.Id, ParentId = entityTreeViewModel.ParentId, IsParent = false, //entityTreeViewModel.ParentId == 0, ReportSequence = entityTreeViewModel.Reports.Count == 0 ? null : string.Join(",", entityTreeViewModel.Reports.Select(x => x.Id)) }; _adminRepo.AddEntityTree(entityTree); entityTreeViewModel.EntityId = entity.Id; addOrDeleteEntityTypes(entityTreeViewModel); await _adminRepo.SaveAllAsync(); entityTreeViewModel.EntityId = entity.Id; entityTreeViewModel.EntityTypeId = entity.EntityTypeId; entityTreeViewModel.Id = entityTree.Id; await _adminRepo.UpdateReports(entityTree, entityTreeViewModel.Reports); return Json(entityTreeViewModel); })); }
public void addOrDeleteEntityTypes(EntityTreeViewModel entityTreeViewModel) { //Remove all maps By tenantId, entitiyId, entityTypePropertyId var removeList = _adminRepo.GetEntityProperty() .Where(t => t.TenantId == Tenant.Id && t.EntityId == entityTreeViewModel.EntityId); _adminRepo.DeleteEntityProperties(removeList.ToList()); //Add all mpas by add list if (entityTreeViewModel.EntityTypeProperties != null && entityTreeViewModel.EntityTypeProperties.Count > 0) { var mapedEntityProperty = Mapper.Map <IEnumerable <EntityProperty> >(entityTreeViewModel.EntityTypeProperties); foreach (var k in mapedEntityProperty) { k.TenantId = Tenant.Id; k.EntityId = entityTreeViewModel.EntityId; } _adminRepo.AddEntityProperties(mapedEntityProperty.ToList()); } }
public GridViewModel(MyCubeGrid grid, EntityTreeViewModel tree) : base(grid, tree) { //DescriptiveName = $"{grid.DisplayName} ({grid.BlocksCount} blocks)"; Blocks.Add(_fillerDefinition, new MtObservableSortedDictionary <long, BlockViewModel>()); }
public GridViewModel(MyCubeGrid grid, EntityTreeViewModel tree) : base(grid, tree) { DescriptiveName = $"{grid.DisplayName} ({grid.BlocksCount} blocks)"; Blocks.Add(new BlockViewModel(null, Tree)); }
public VoxelMapViewModel(MyVoxelBase e, EntityTreeViewModel tree) : base(e, tree) { }
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree) { _character = character; character.ControllerInfo.ControlAcquired += ControllerInfo_ControlAcquired; character.ControllerInfo.ControlReleased += ControllerInfo_ControlAcquired; }
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree) { }
public CharacterViewModel(MyCharacter character, EntityTreeViewModel tree) : base(character, tree) { character.ControllerInfo.ControlAcquired += (x) => { OnPropertyChanged(nameof(Name)); }; character.ControllerInfo.ControlReleased += (x) => { OnPropertyChanged(nameof(Name)); }; }