Ejemplo n.º 1
0
    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();
    }
Ejemplo n.º 2
0
        public ComboBox CreateInput(int row, int col, int landingIndex)
        {
            if (OptionsListNames == null && landingIndex >= OptionsListNames.Count)
            {
                return(null);
            }
            ComboBox cb;

            if (row < 0 || col < 0)
            {
                cb = TableBuilder.ComboBox("CB_" + SelectedIds.Count, OptionsListNames, landingIndex, UpdateSelectedIds);
            }
            else
            {
                cb = TableBuilder.ComboBox("CB_" + SelectedIds.Count, OptionsListNames, landingIndex, row, col, UpdateSelectedIds);
            }
            cb.Width = 120;
            SelectedIds.Add(OptionsListIds[landingIndex]);
            return(cb);
        }
        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);
                }
            }
        }