Пример #1
0
        private void AddSuperTooltipProvider([NotNull] IIdentity identity, [NotNull] GridCell cell)
        {
            var provider = new GridCellSuperTooltipProvider(cell);

            cell.Tag = provider;
            _superTooltip.SetSuperTooltip(provider, _model.GetSuperTooltipInfo(identity));
        }
Пример #2
0
        public void Initialize([NotNull] IThreatModel model, [NotNull] IThreatEventsContainer container)
        {
            _model = model;

            if (container is IIdentity identity)
            {
                _associatedTo.Image = identity.GetImage(Interfaces.ImageSize.Small);
                _associatedTo.Text  = identity.Name;
                _superTooltip.SetSuperTooltip(_associatedTo, model.GetSuperTooltipInfo(identity, false));
            }

            _severity.Items.Clear();
            var severities = _model.Severities?.Where(x => x.Visible).ToArray();

            if (severities?.Any() ?? false)
            {
                _severity.Items.AddRange(severities);
            }

            var threatTypes = model.ThreatTypes?.OrderBy(x => x.Name).ToArray();

            if (threatTypes != null && (container.ThreatEvents?.Any() ?? false))
            {
                threatTypes =
                    threatTypes
                    .Except(container.ThreatEvents.Select(x => x.ThreatType))
                    .ToArray();
            }

            if (threatTypes?.Any() ?? false)
            {
                _threatTypes.Items.AddRange(threatTypes);
                _threatTypes.Tag = threatTypes;
            }
            else
            {
                _useExisting.Enabled = false;
                _createNew.Checked   = true;
                _threatTypes.Enabled = false;
                _name.Enabled        = true;
                _description.Enabled = true;
                _severity.Enabled    = true;
            }
        }