コード例 #1
0
        private void LoadRoadmapStatusDetails(RoadmapStatus status)
        {
            var mitigations = _model.Mitigations?
                              .Where(x => x.GetStatus() == status)
                              .OrderBy(x => x.Name)
                              .ToArray();

            if (mitigations?.Any() ?? false)
            {
                var container = new GridRow(status.GetEnumLabel());
                _roadmapDetails.PrimaryGrid.Rows.Add(container);

                var panel = new GridPanel
                {
                    Name               = status.GetEnumLabel(),
                    AllowRowDelete     = false,
                    AllowRowInsert     = false,
                    AllowRowResize     = true,
                    ShowRowDirtyMarker = false,
                    ShowTreeButtons    = false,
                    ShowTreeLines      = false,
                    ShowRowHeaders     = false,
                    InitialActiveRow   = RelativeRow.None,
                    InitialSelection   = RelativeSelection.None
                };
                panel.Columns.Add(new GridColumn("Name")
                {
                    HeaderText   = "Mitigation Name",
                    AutoSizeMode = ColumnAutoSizeMode.Fill,
                    DataType     = typeof(string),
                    AllowEdit    = false
                });
                panel.Columns.Add(new GridColumn("ControlType")
                {
                    HeaderText = "Control Type",
                    DataType   = typeof(string),
                    AllowEdit  = false,
                    Width      = 75
                });
                container.Rows.Add(panel);

                foreach (var mitigation in mitigations)
                {
                    panel.Rows.Add(new GridRow(mitigation.Name, mitigation.ControlType.GetEnumLabel())
                    {
                        Tag = mitigation
                    });
                }
            }
        }
コード例 #2
0
        private void ShowRoadmapStatus(RoadmapStatus status)
        {
            bool ok = false;

            var mitigations = _model.Mitigations?.ToArray();

            if (mitigations?.Any() ?? false)
            {
                var selectedMitigations = new List <Guid>();

                switch (status)
                {
                case RoadmapStatus.ShortTerm:
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.ShortTerm);
                    break;

                case RoadmapStatus.MidTerm:
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.ShortTerm);
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.MidTerm);
                    break;

                case RoadmapStatus.LongTerm:
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.ShortTerm);
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.MidTerm);
                    UpdateSelectedMitigations(selectedMitigations, mitigations, RoadmapStatus.LongTerm);
                    break;
                }

                var schemaManager = new ResidualRiskEstimatorPropertySchemaManager(_model);
                var projected     =
                    schemaManager.SelectedEstimator?.GetProjectedThreatTypesResidualRisk(_model, selectedMitigations);

                if (projected?.Any() ?? false)
                {
                    _chart.RefreshChart(_model, projected);
                    _currentStatus  = status;
                    _chartName.Text = status.GetEnumLabel();
                    ok = true;
                }
            }

            _previous.Visible  = ok;
            _next.Visible      = ok;
            _chartName.Visible = ok;
        }
コード例 #3
0
        private IEnumerable <Cell> GetCells([NotNull] IEnumerable <IMitigation> mitigations, RoadmapStatus status)
        {
            IEnumerable <Cell> result = null;

            if (mitigations.Any())
            {
                var list = new List <Cell>();

                list.Add(new Cell(status.GetEnumLabel(), null, null, true));
                list.Add(new Cell(string.Empty));

                foreach (var mitigation in mitigations)
                {
                    list.Add(new Cell(mitigation.Name, null, null, new [] { mitigation.Id }));
                    list.Add(new Cell(GetLines(mitigation)));
                }

                result = list;
            }

            return(result);
        }