/// <summary> /// Selects an entity. /// </summary> /// <param name="entity">The entity to select.</param> private void Set([NotNull] Entity entity) { var entityId = Editor.Controller.GetAbsoluteId(entity); if (!SelectableIds.Contains(entityId) || SelectedIds.Count == 1 && SelectedIds.Contains(entityId)) { return; } IsControllingMouse = true; Editor.Dispatcher.InvokeAsync(() => { var viewModel = (EntityHierarchyElementViewModel)Editor.FindPartViewModel(entityId); Editor.ClearSelection(); if (viewModel is not null) { Editor.SelectedContent.Add(viewModel); } Editor.Controller.InvokeAsync(() => IsControllingMouse = false); }); }
public IEnumerable <ProjectFieldDropdownValue> GetPossibleValues( AccessArguments modelAccessArguments) { return(OrderedValueCache.Value.Where(v => SelectedIds.Contains(v.ProjectFieldDropdownValueId) || (v.IsActive && (v.PlayerSelectable || modelAccessArguments.MasterAccess)) )); }
/// <summary> Excel导出 /// </summary> protected void Ib_ExportData_Click(object sender, EventArgs e) { if (!IsAll && SelectedIds.Count == 0) { RAM.Alert("请选择导出数据!"); return; } var supplierGoodsInfoList = new List <SupplierGoodsInfo>(); switch (RCB_SearchType.SelectedValue) { case "1": supplierGoodsInfoList = GetSupplierGoodsInfos(); break; case "3": string searchKey = RCB_SelectKey.Text; var total = InformationsGrid.VirtualItemCount; int pageindex = 1; const int PAGE_SIZE = 30; var count = Math.Ceiling((double)total / PAGE_SIZE); int? state = null; if (DDL_HaveInformation.SelectedValue != "0") { state = Convert.ToInt32(DDL_HaveInformation.SelectedValue); } int?dataState = null; if (DDL_Period.SelectedValue != "0") { dataState = Convert.ToInt32(DDL_Period.SelectedValue); } if (count > 0) { while (pageindex <= count) { long totalCount; var goodsList = _goodsCenterSao.SelectGoodsInformationInfosByPage(searchKey, TB_CertificateNumber.Text, state, dataState, pageindex, PAGE_SIZE, out totalCount); supplierGoodsInfoList.AddRange(goodsList); pageindex++; } } break; } if (supplierGoodsInfoList.Count > 0) { var dataList = IsAll?supplierGoodsInfoList.Where(act => !UnSelectedIds.Contains(act.ID)).ToList() :supplierGoodsInfoList.Where(act => SelectedIds.Contains(act.ID)).ToList(); OutPutExcel(dataList); } else { RAM.Alert("数据为空!"); } }
public void CheckboxClicked(TId selectedId, object?value) { if ((bool?)value == true) { if (!SelectedIds.Contains(selectedId)) { SelectedIds.Add(selectedId); } } else if (SelectedIds.Contains(selectedId)) { SelectedIds.Remove(selectedId); } StateHasChanged(); }
/// <summary> /// Adds the given entity from the selection. /// </summary> /// <param name="entity">The entity that must be removed from selection.</param> private void Remove([NotNull] Entity entity) { var entityId = Editor.Controller.GetAbsoluteId(entity); if (!SelectedIds.Contains(entityId)) { return; } IsControllingMouse = true; Editor.Dispatcher.InvokeAsync(() => { var viewModel = (EntityHierarchyElementViewModel)Editor.FindPartViewModel(entityId); if (viewModel != null) { Editor.SelectedContent.Remove(viewModel); } Editor.Controller.InvokeAsync(() => IsControllingMouse = false); }); }
private void AddToSelection([NotNull] EntityHierarchyElementViewModel element) { lock (LockObject) { if (!element.IsSelectable) { return; } // Add the entity id to the selected ids SelectedIds.Add(element.Id); // Check if one of its parents is in the selection var parent = element.TransformParent; while (parent != null) { if (SelectedIds.Contains(parent.Id)) { break; } parent = parent.TransformParent; } // If so, the SelectedRootIds collection does not need to be updated. if (parent != null) { return; } // Otherwise, it's a new root entity in the selection. SelectedRootIds.Add(element.Id); // Remove its children that were previously root entities in the selection. foreach (var child in element.TransformChildren.SelectDeep(x => x.TransformChildren)) { SelectedRootIds.Remove(child.Id); } } }
private void RemoveFromSelection([NotNull] EntityHierarchyElementViewModel element) { lock (LockObject) { SelectedIds.Remove(element.Id); // Remove the root entity from the selected root entities if (SelectedRootIds.Remove(element.Id) && element.IsLoaded) { // Ensure all children that are selected are properly added to the selected root collection foreach (var child in element.TransformChildren.SelectDeep(x => x.TransformChildren).Where(x => SelectedIds.Contains(x.Id))) { // Check if one of its parents is in the selection var parent = child.TransformParent; while (parent != element && parent != null) { if (SelectedIds.Contains(parent.Id)) { break; } parent = parent.TransformParent; } // If so, the SelectedRootIds collection does not need to be updated. if (parent != element) { return; } // Otherwise, it's a new root entity in the selection. SelectedRootIds.Add(child.Id); } } } }
/// <summary> /// Indicates whether the selection currently contains the given entity. /// </summary> /// <param name="entity">The entity to check.</param> /// <returns><c>True</c> if the entity is currently selected, <c>False</c> otherwise.</returns> private bool Contains([NotNull] Entity entity) { var entityId = Editor.Controller.GetAbsoluteId(entity); return(SelectedIds.Contains(entityId)); }
public IEnumerable <ProjectFieldDropdownValue> GetDropdownValues() { return(OrderedValueCache.Value.Where(v => SelectedIds.Contains(v.ProjectFieldDropdownValueId))); }
public IEnumerable <ProjectFieldDropdownValue> GetPossibleValues() { return(Field.GetOrderedValues().Where(v => v.IsActive || SelectedIds.Contains(v.ProjectFieldDropdownValueId))); }