Beispiel #1
0
        public void RecalculateVisibleViolations()
        {
            VisibleViolations.Clear();
            ViolationState state;

            switch (DataModel.Instance.CurrentWorkbook.SelectedTabIndex)
            {
            case WorkbookModel.Tabs.OpenViolations:
                state = ViolationState.OPEN;
                break;

            case WorkbookModel.Tabs.ArchivedViolations:
                state = ViolationState.SOLVED;
                break;

            case WorkbookModel.Tabs.IgnoredViolations:
                state = ViolationState.IGNORE;
                break;

            case WorkbookModel.Tabs.LaterViolations:
                state = ViolationState.LATER;
                break;

            default:
                state = ViolationState.NONE;
                break;
            }

            foreach (var vio in Violations)
            {
                if (vio.ViolationState == state)
                {
                    VisibleViolations.Add(vio);
                }
            }

            if (VisibleViolations.Count > 0)
            {
                DrawIcon();
                SetVisibility();
                ViolationsPane = new ListCollectionView(VisibleViolations);
                ViolationsPane.SortDescriptions.Add(
                    new SortDescription("FirstOccurrence", ListSortDirection.Descending));
                ViolationsPane.SortDescriptions.Add(new SortDescription("Severity", ListSortDirection.Descending));
            }
            else
            {
                RemoveIcon();
                SelectedViolation = null;
            }
        }
Beispiel #2
0
        public void RecalculateViewModel()
        {
            VisibleViolations.Clear();
            ScenarioCells.Clear();
            SanityCells.Clear();
            RuleCells.Clear();

            ViolationState state;

            switch (SelectedTabIndex)
            {
            case Tabs.OpenViolations:
                SelectedTabLabel = Resources.tl_Sidebar_Open;
                state            = ViolationState.OPEN;
                break;

            case Tabs.ArchivedViolations:
                SelectedTabLabel = Resources.tl_Sidebar_Archived;
                state            = ViolationState.SOLVED;
                break;

            case Tabs.IgnoredViolations:
                SelectedTabLabel = Resources.tl_Sidebar_Ignored;
                state            = ViolationState.IGNORE;
                break;

            case Tabs.LaterViolations:
                SelectedTabLabel = Resources.tl_Sidebar_Later;
                state            = ViolationState.LATER;
                break;

            case Tabs.ScenarioCells:
                SelectedTabLabel = Resources.tl_Sidebar_Cells;
                state            = ViolationState.NONE;
                break;

            case Tabs.Scenarios:
                SelectedTabLabel = Resources.tl_Sidebar_Scenarios;
                state            = ViolationState.NONE;
                break;

            case Tabs.Rules:
                SelectedTabLabel = Resources.tl_Sidebar_Rules;
                state            = ViolationState.NONE;
                break;

            default:
                state = ViolationState.NONE;
                break;
            }

            foreach (var vio in Violations)
            {
                if (vio.ViolationState == state)
                {
                    VisibleViolations.Add(vio);
                }
            }
            // create all cell error infos and add marked cells to lists
            var cellList = new List <Cell>(Cells.Values);

            foreach (var cell in cellList)
            {
                cell.RecalculateVisibleViolations();

                if (cell.ScenarioCellType != ScenarioCellType.NONE)
                {
                    ScenarioCells.Add(cell);
                }
                if (cell.SanityCellType != SanityCellType.NONE)
                {
                    SanityCells.Add(cell);
                }
                if (cell.RuleCellType == RuleCellType.CELL)
                {
                    RuleCells.Add(cell);
                }
            }
            NotifyPropertyChanged("UnreadViolationCount");
        }