Skip to content

Commit 3a004bf

Browse files
authored
Merge pull request #3659 from retailcoder/ProjectRefs
2 parents bb4e8dc + 9ec87fc commit 3a004bf

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

RetailCoder.VBE/AddRemoveReferences/RegisteredLibraryFinderService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ private Version GetVersionFromKeyName(string name)
9797

9898
private string GetLibraryPath(RegistryKey versionSubKey, out int subKeyValue)
9999
{
100+
subKeyValue = 0;
100101
var result = string.Empty;
101102
foreach (var subKeyName in versionSubKey.GetSubKeyNames())
102103
{

RetailCoder.VBE/UI/AddRemoveReferences/AddRemoveReferencesViewModel.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace Rubberduck.UI.AddRemoveReferences
1010
{
1111
public class AddRemoveReferencesViewModel : ViewModelBase
1212
{
13-
public AddRemoveReferencesViewModel(IEnumerable<ReferenceModel> model)
13+
public AddRemoveReferencesViewModel(IReadOnlyList<ReferenceModel> model)
1414
{
1515
ComLibraries = model.Where(item => item.Type == ReferenceKind.TypeLibrary);
16-
16+
VbaProjects = model.Where(item => item.Type == ReferenceKind.Project);
1717
}
1818

1919
/// <summary>
@@ -31,7 +31,14 @@ public AddRemoveReferencesViewModel(IEnumerable<ReferenceModel> model)
3131
/// </summary>
3232
public ICommand MoveUpCommand { get; }
3333

34+
/// <summary>
35+
/// Moves the <see cref="SelectedReference"/> down on the 'Priority' tab.
36+
/// </summary>
37+
public ICommand MoveDownCommand { get; }
38+
3439
public IEnumerable<ReferenceModel> ComLibraries { get; }
40+
public IEnumerable<ReferenceModel> VbaProjects { get; }
41+
3542
public ReferenceModel SelectedLibrary { get; }
3643
public ReferenceModel SelectedProject { get; }
3744
public ReferenceModel SelectedReference { get; }

RetailCoder.VBE/UI/AddRemoveReferences/AddRemoveReferencesWindow.xaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
<BitmapImage x:Key="VbaProjectIcon" UriSource="../../Resources/Custom/PNG/ObjectClass.png" />
1616
<BitmapImage x:Key="PriorityIcon" UriSource="../../Resources/edit-list-order.png" />
1717
<BitmapImage x:Key="MoveUpIcon" UriSource="../../Resources/arrow-090.png" />
18+
<BitmapImage x:Key="MoveDownIcon" UriSource="../../Resources/arrow-270.png" />
1819

1920
<local:ReferenceStatusImageSourceConverter x:Key="StatusToIcon" />
2021
<Style x:Key="DialogButtonStyle" TargetType="Button">
@@ -141,7 +142,7 @@
141142
</Grid>
142143
</Border>
143144
<ListView Margin="10"
144-
ItemsSource="{Binding ComLibraries}"
145+
ItemsSource="{Binding VbaProjects}"
145146
SelectedItem="{Binding SelectedProject}"
146147
HorizontalContentAlignment="Stretch">
147148
<ListView.ItemTemplate>
@@ -186,13 +187,19 @@
186187
<ColumnDefinition Width="50" />
187188
<ColumnDefinition Width="*" />
188189
<ColumnDefinition Width="20" />
190+
<ColumnDefinition Width="20" />
189191
</Grid.ColumnDefinitions>
190192
<TextBlock Grid.Column="0" Text="{Binding Name}" Margin="2,0" />
191193
<TextBlock Grid.Column="1" Text="{Binding Version}" Margin="2,0" />
192194
<TextBlock Grid.Column="2" Text="{Binding Description}" Margin="2,0" />
193-
<Button Grid.Column="3" Command="{Binding DataContext.MoveUpCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:AddRemoveReferencesWindow}}}">
195+
<Button Grid.Column="3" Margin="1"
196+
Command="{Binding DataContext.MoveUpCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:AddRemoveReferencesWindow}}}">
194197
<Image Source="{StaticResource MoveUpIcon}" />
195198
</Button>
199+
<Button Grid.Column="4" Margin="1"
200+
Command="{Binding DataContext.MoveDownCommand, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:AddRemoveReferencesWindow}}}">
201+
<Image Source="{StaticResource MoveDownIcon}" />
202+
</Button>
196203
</Grid>
197204
</DataTemplate>
198205
</ListView.ItemTemplate>

0 commit comments

Comments
 (0)