rubberduck-vba / Rubberduck

Compare 99e9094 ... +16 ... 383169e

Missing base report.

Unable to compare commits because the base of the compare did not upload a coverage report.

Learn more here.


@@ -1,17 +1,21 @@
Loading
1 1
using System;
2 2
using System.Collections.Generic;
3 +
using System.Collections.ObjectModel;
3 4
using System.Linq;
5 +
using System.Windows.Controls;
4 6
using System.Xml.Serialization;
7 +
using Rubberduck.UI;
5 8
6 9
namespace Rubberduck.Settings
7 10
{
8 11
    internal interface IToDoListSettings
9 12
    {
10 13
        ToDoMarker[] ToDoMarkers { get; set; }
14 +
        ObservableCollection<GridViewColumnInfo> ColumnHeadersInformation { get; set; }
11 15
    }
12 16
13 17
    [XmlType(AnonymousType = true)]
14 -
    public class ToDoListSettings : IToDoListSettings, IEquatable<ToDoListSettings>
18 +
    public class ToDoListSettings : ViewModelBase, IToDoListSettings, IEquatable<ToDoListSettings>
15 19
    {
16 20
        private IEnumerable<ToDoMarker> _markers;
17 21
@@ -26,21 +30,90 @@
Loading
26 30
            }
27 31
        }
28 32
33 +
        private ObservableCollection<GridViewColumnInfo> _columnHeadersInfo;
34 +
        public ObservableCollection<GridViewColumnInfo> ColumnHeadersInformation
35 +
        {
36 +
            get => _columnHeadersInfo;
37 +
            set
38 +
            {
39 +
                if (value != _columnHeadersInfo)
40 +
                {
41 +
                    _columnHeadersInfo = value;
42 +
                    OnPropertyChanged();
43 +
                }
44 +
            }
45 +
        }
46 +
29 47
        /// <Summary>
30 48
        /// Default constructor required for XML serialization.
31 49
        /// </Summary>
32 50
        public ToDoListSettings()
33 51
        {
34 52
        }
35 53
36 -
        public ToDoListSettings(IEnumerable<ToDoMarker> defaultMarkers)
54 +
        public ToDoListSettings(IEnumerable<ToDoMarker> defaultMarkers, ObservableCollection<GridViewColumnInfo> columnHeaders)
37 55
        {
38 56
            _markers = defaultMarkers;
57 +
            ColumnHeadersInformation = columnHeaders;
39 58
        }
40 59
41 60
        public bool Equals(ToDoListSettings other)
42 61
        {
43 -
            return other != null && ToDoMarkers.SequenceEqual(other.ToDoMarkers);
62 +
            return other != null 
63 +
                && ToDoMarkers.SequenceEqual(other.ToDoMarkers)
64 +
                && ColumnHeadersInformation.Equals(other.ColumnHeadersInformation);
65 +
        }
66 +
    }
67 +
68 +
    public class GridViewColumnInfo : ViewModelBase, IEquatable<GridViewColumnInfo>
69 +
    {
70 +
        private int _displayIndex;
71 +
        public int DisplayIndex
72 +
        {
73 +
            get => _displayIndex;
74 +
            set
75 +
            {
76 +
                if (value != _displayIndex)
77 +
                {
78 +
                    _displayIndex = value;
79 +
                    OnPropertyChanged();
80 +
                }
81 +
            }
82 +
        }
83 +
84 +
        [XmlElement(Type = typeof(DataGridLength))]
85 +
        private DataGridLength _width;
86 +
87 +
        public DataGridLength Width
88 +
        {
89 +
            get => _width;
90 +
            set
91 +
            {
92 +
                if (value != _width)
93 +
                {
94 +
                    _width = value;
95 +
                    OnPropertyChanged();
96 +
                }
97 +
            }
98 +
        }
99 +
100 +
        /// <Summary>
101 +
        /// Default constructor required for XML serialization.
102 +
        /// </Summary>
103 +
        public GridViewColumnInfo()
104 +
        {
105 +
        }
106 +
107 +
        public GridViewColumnInfo(int displayIndex, DataGridLength width)
108 +
        {
109 +
            DisplayIndex = displayIndex;
110 +
            Width = width;
111 +
        }
112 +
113 +
        public bool Equals(GridViewColumnInfo other)
114 +
        {
115 +
            return DisplayIndex == other.DisplayIndex
116 +
                && Width == other.Width;
44 117
        }
45 118
    }
46 119
}

@@ -36,15 +36,15 @@
Loading
36 36
        }
37 37
38 38
        public static readonly DependencyProperty TextProperty =
39 -
            DependencyProperty.Register("Text", typeof(string), typeof(BindableTextEditor), new PropertyMetadata((obj, args) =>
39 +
            DependencyProperty.Register(nameof(Text), typeof(string), typeof(BindableTextEditor), new PropertyMetadata((obj, args) =>
40 40
            {
41 41
                var target = (BindableTextEditor)obj;
42 42
                target.Text = (string)args.NewValue;
43 43
            }));
44 44
45 45
        protected override void OnTextChanged(EventArgs e)
46 46
        {
47 -
            RaisePropertyChanged("Text");
47 +
            RaisePropertyChanged(nameof(Text));
48 48
            base.OnTextChanged(e);
49 49
        }
50 50

@@ -9,8 +9,8 @@
Loading
9 9
    public sealed partial class ToDoExplorerWindow : UserControl, IDockableUserControl
10 10
    {
11 11
        private const string ClassId = "8B071EDA-2C9C-4009-9A22-A1958BF98B28"; // todo get from Resources.Registration?
12 -
        string IDockableUserControl.ClassId { get { return ClassId; } }
13 -
        string IDockableUserControl.Caption { get { return RubberduckUI.TodoExplorer_Caption; } }
12 +
        string IDockableUserControl.ClassId => ClassId;
13 +
        string IDockableUserControl.Caption => RubberduckUI.TodoExplorer_Caption;
14 14
15 15
        private ToDoExplorerWindow()
16 16
        {
@@ -19,14 +19,10 @@
Loading
19 19
20 20
        public ToDoExplorerWindow(ToDoExplorerViewModel viewModel) : this()
21 21
        {
22 -
            _viewModel = viewModel;
23 -
            TodoExplorerControl.DataContext = _viewModel;
24 -
        }
25 -
26 -
        private readonly ToDoExplorerViewModel _viewModel;
27 -
        public ToDoExplorerViewModel ViewModel
28 -
        {
29 -
            get { return _viewModel; }
22 +
            ViewModel = viewModel;
23 +
            TodoExplorerControl.DataContext = ViewModel;
24 +
            viewModel.UpdateColumnHeaderInformationToMatchCached(TodoExplorerControl.MainGrid.Columns);
30 25
        }
26 +
        public ToDoExplorerViewModel ViewModel { get; }
31 27
    }
32 28
}

@@ -20,6 +20,7 @@
Loading
20 20
using Rubberduck.Parsing.UIContext;
21 21
using Rubberduck.VBEditor.Utility;
22 22
using Rubberduck.SettingsProvider;
23 +
using System.Windows.Controls;
23 24
24 25
namespace Rubberduck.UI.ToDoItems
25 26
{
@@ -88,6 +89,39 @@
Loading
88 89
            Items = CollectionViewSource.GetDefaultView(_items);
89 90
            OnPropertyChanged(nameof(Items));
90 91
            Grouping = ToDoItemGrouping.Marker;
92 +
93 +
            _columnHeaders = _configService.Read().UserSettings.ToDoListSettings.ColumnHeadersInformation;
94 +
        }
95 +
96 +
        private ObservableCollection<GridViewColumnInfo> _columnHeaders { get; }
97 +
        public void UpdateColumnHeaderInformation(ObservableCollection<DataGridColumn> columns)
98 +
        {
99 +
            _columnHeaders[0].DisplayIndex = columns[0].DisplayIndex;
100 +
            _columnHeaders[1].DisplayIndex = columns[1].DisplayIndex;
101 +
            _columnHeaders[2].DisplayIndex = columns[2].DisplayIndex;
102 +
            _columnHeaders[3].DisplayIndex = columns[3].DisplayIndex;
103 +
104 +
            _columnHeaders[0].Width = columns[0].Width;
105 +
            _columnHeaders[1].Width = columns[1].Width;
106 +
            _columnHeaders[2].Width = columns[2].Width;
107 +
            _columnHeaders[3].Width = columns[3].Width;
108 +
109 +
            var userSettings = _configService.Read().UserSettings;
110 +
            userSettings.ToDoListSettings.ColumnHeadersInformation = _columnHeaders;
111 +
            _configService.Save(new Configuration(userSettings));
112 +
        }
113 +
114 +
        public void UpdateColumnHeaderInformationToMatchCached(ObservableCollection<DataGridColumn> columns)
115 +
        {
116 +
            columns[0].DisplayIndex = _columnHeaders[0].DisplayIndex;
117 +
            columns[1].DisplayIndex = _columnHeaders[1].DisplayIndex;
118 +
            columns[2].DisplayIndex = _columnHeaders[2].DisplayIndex;
119 +
            columns[3].DisplayIndex = _columnHeaders[3].DisplayIndex;
120 +
121 +
            columns[0].Width = _columnHeaders[0].Width;
122 +
            columns[1].Width = _columnHeaders[1].Width;
123 +
            columns[2].Width = _columnHeaders[2].Width;
124 +
            columns[3].Width = _columnHeaders[3].Width;
91 125
        }
92 126
93 127
        private readonly ObservableCollection<ToDoItem> _items = new ObservableCollection<ToDoItem>();

@@ -7,10 +7,10 @@
Loading
7 7
    public partial class GroupingGrid
8 8
    {
9 9
        public static readonly DependencyProperty ShowGroupingItemCountProperty =
10 -
            DependencyProperty.Register("ShowGroupingItemCount", typeof (bool), typeof(GroupingGrid));
10 +
            DependencyProperty.Register(nameof(ShowGroupingItemCount), typeof (bool), typeof(GroupingGrid));
11 11
12 12
        public static readonly DependencyProperty InitialExpandedStateProperty =
13 -
            DependencyProperty.Register("InitialExpandedState", typeof(bool), typeof(GroupingGrid));
13 +
            DependencyProperty.Register(nameof(InitialExpandedState), typeof(bool), typeof(GroupingGrid));
14 14
15 15
        public bool ShowGroupingItemCount
16 16
        {

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Click to load this diff.
Loading diff...

Unable to process changes.

No base report to compare against.

Files Coverage
Rubberduck.CodeAnalysis 88.85%
Rubberduck.Core 31.89%
Rubberduck.Interaction 9.80%
Rubberduck.Main 46.71%
Rubberduck.Parsing 80.37%
Rubberduck.Refactorings 89.20%
Rubberduck.RegexAssistant 65.19%
Rubberduck.Resources 66.67%
Rubberduck.SettingsProvider 31.94%
Rubberduck.SmartIndenter 78.72%
Rubberduck.UnitTesting 68.22%
RubberduckCodeAnalysis 60.62%
Rubberduck.JunkDrawer/Output/StringExtensions.cs 87.50%
Project Totals (1079 files) 64.13%
Loading