public ThreatSourceNodeParentChild([NotNull] ThreatSource threatSource,
                                           [Required] string viewId, [NotNull] ThreatSourceNode node)
        {
            Node = node;
            var children = threatSource.GetChildren(viewId, node);

            if (children != null)
            {
                Children = children.Select(x => new ThreatSourceNodeParentChild(threatSource, viewId, x));
            }
        }
예제 #2
0
        public void Initialize([NotNull] ThreatSourceNode node)
        {
            _threatSourceType = node.ThreatSourceType;

            var properties = node.Properties;

            if (properties != null)
            {
                try
                {
                    _loading = true;

                    SuspendLayout();

                    if (_table.Controls.Count > 0)
                    {
                        _rowCount = 0;
                        _table.Dispose();
                        InitializeComponent();
                    }

                    _table.SuspendLayout();

                    //_properties.Clear();

                    foreach (var property in properties)
                    {
                        if (IsSingleLine(property.Value))
                        {
                            AddSingleLineTextBox(property.Key, property.Key, property.Value, true);
                        }
                        else
                        {
                            AddRichTextBox(property.Key, property.Key, property.Value, true);
                        }
                        //_properties.Add(property.Key, property.Value);
                        AddCheckBox("Include property in model", property.Key);
                    }

                    AddDummyRow();
                }
                finally
                {
                    _loading = false;
                    _table.ResumeLayout();
                    ResumeLayout();
                }
            }
        }
예제 #3
0
        internal IEnumerable <ThreatSourceNode> GetChildren([Required] string viewId, [NotNull] ThreatSourceNode node)
        {
            IEnumerable <ThreatSourceNode> result = null;

            if (_parentChild.ContainsKey(viewId))
            {
                var parentChild = _parentChild[viewId];
                if (parentChild != null && parentChild.ContainsKey(node.Id))
                {
                    result = parentChild[node.Id].Select(x => _nodes[x]);
                }
            }

            return(result);
        }