Beispiel #1
0
 public void RemoveNode([NotNull] RoadmapItem node)
 {
     Document.Remove(node);
 }
Beispiel #2
0
        private void LoadModel()
        {
            _loading = true;
            RemoveEventSubscriptions();

            _notAssessedPalette.Clear();
            _shortTermPalette.Clear();
            _midTermPalette.Clear();
            _longTermPalette.Clear();
            _noActionRequiredPalette.Clear();

            var mitigations = _model?.GetUniqueMitigations()?.OrderBy(x => x.Name).ToArray();

            if ((mitigations?.Any() ?? false) && _filter != null)
            {
                mitigations = _filter.Filter(mitigations)?.ToArray();
            }

            if (mitigations?.Any() ?? false)
            {
                var schemaManager     = new ResidualRiskEstimatorPropertySchemaManager(_model);
                var effectivenessDict =
                    schemaManager.SelectedEstimator?.CategorizeMitigations(_model);

                foreach (var mitigation in mitigations)
                {
                    Effectiveness effectiveness = Effectiveness.Unknown;
                    if (effectivenessDict?.ContainsKey(mitigation.Id) ?? false)
                    {
                        effectiveness = effectivenessDict[mitigation.Id];
                    }

                    var status = mitigation.GetStatus(out var automatedCalculation);
                    var node   = new RoadmapItem(mitigation, effectiveness);
                    if (_actions != null)
                    {
                        node.SetContextAwareActions(_actions);
                    }

                    switch (status)
                    {
                    case RoadmapStatus.NotAssessed:
                        _notAssessedPalette.AddNode(node);
                        break;

                    case RoadmapStatus.ShortTerm:
                        _shortTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.MidTerm:
                        _midTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.LongTerm:
                        _longTermPalette.AddNode(node);
                        break;

                    case RoadmapStatus.NoActionRequired:
                        _noActionRequiredPalette.AddNode(node);
                        if (automatedCalculation)
                        {
                            mitigation.SetStatus(RoadmapStatus.NoActionRequired);
                        }
                        break;
                    }
                }

                _notAssessedPalette.RefreshNodes();
                _shortTermPalette.RefreshNodes();
                _midTermPalette.RefreshNodes();
                _longTermPalette.RefreshNodes();
                _noActionRequiredPalette.RefreshNodes();

                _chart.RefreshChart(_model);
            }

            _loading = false;
        }
Beispiel #3
0
 public void AddNode([NotNull] RoadmapItem node)
 {
     Document.Add(node);
     MitigationDropped?.Invoke(node.Mitigation);
 }