Skip to content
Permalink
Browse files

Merge branch 'next' into libgit2sharp24

  • Loading branch information...
Nelson Vides
Nelson Vides committed Nov 24, 2017
2 parents 11d2e7e + e67b182 commit 4e5cd9dce0de92501c192df1ede42d1db9ad2f56
Showing with 263 additions and 227 deletions.
  1. +5 −5 RetailCoder.VBE/App.cs
  2. +15 −5 RetailCoder.VBE/UI/About/AboutControl.xaml
  3. +34 −1 RetailCoder.VBE/UI/About/AboutControl.xaml.cs
  4. +1 −7 RetailCoder.VBE/UI/About/AboutControlViewModel.cs
  5. +1 −1 RetailCoder.VBE/UI/CodeExplorer/CodeExplorerControl.xaml.cs
  6. +9 −12 RetailCoder.VBE/UI/CodeExplorer/Commands/AddComponentCommand.cs
  7. +3 −4 RetailCoder.VBE/UI/Controls/BindableSelectedItemBehavior.cs
  8. +3 −6 RetailCoder.VBE/UI/Controls/BindableTextEditor.cs
  9. +1 −2 RetailCoder.VBE/UI/Controls/DeclarationTypeToStringConverter.cs
  10. +1 −14 RetailCoder.VBE/UI/Controls/EmptyUIRefresh.xaml.cs
  11. +4 −4 RetailCoder.VBE/UI/Controls/GroupingGrid.xaml.cs
  12. +12 −11 RetailCoder.VBE/UI/Controls/MenuItemGroup.cs
  13. +3 −16 RetailCoder.VBE/UI/Controls/NumberPicker.xaml.cs
  14. +10 −8 RetailCoder.VBE/UI/Controls/SearchResultItem.cs
  15. +1 −1 RetailCoder.VBE/UI/Controls/SearchResultPresenterInstanceManager.cs
  16. +16 −21 RetailCoder.VBE/UI/Controls/SearchResultsViewModel.cs
  17. +9 −11 RetailCoder.VBE/UI/Controls/SearchResultsWindowViewModel.cs
  18. +3 −4 RetailCoder.VBE/UI/FindSymbol/FindSymbolControl.xaml.cs
  19. +1 −1 RetailCoder.VBE/UI/Inspections/InspectionImageSourceConverter.cs
  20. +29 −2 RetailCoder.VBE/UI/RubberduckUI.Designer.cs
  21. +12 −3 RetailCoder.VBE/UI/RubberduckUI.resx
  22. +2 −2 RetailCoder.VBE/UI/ToDoItems/ToDoExplorerControl.xaml.cs
  23. +23 −19 RetailCoder.VBE/UI/ToDoItems/ToDoExplorerViewModel.cs
  24. +6 −7 RetailCoder.VBE/UI/UnitTesting/TestExplorerControl.xaml
  25. +4 −7 RetailCoder.VBE/UI/UnitTesting/TestExplorerControl.xaml.cs
  26. +5 −6 RetailCoder.VBE/UI/UnitTesting/TestExplorerModel.cs
  27. +16 −12 RetailCoder.VBE/UI/UnitTesting/TestExplorerViewModel.cs
  28. +2 −2 RetailCoder.VBE/UI/UnitTesting/TestOutcomeImageSourceConverter.cs
  29. +3 −4 RetailCoder.VBE/UI/UnitTesting/TestResultToOutcomeTextConverter.cs
  30. +1 −2 RetailCoder.VBE/UI/ViewModelBase.cs
  31. +12 −6 RetailCoder.VBE/UnitTesting/TestMethod.cs
  32. +16 −21 RetailCoder.VBE/UnitTesting/TestResult.cs
@@ -192,11 +192,11 @@ public void LogRubberduckStart()
GlobalDiagnosticsContext.Set("RubberduckVersion", version.ToString());
var headers = new List<string>
{
string.Format("\r\n\tRubberduck version {0} loading:", version),
string.Format("\tOperating System: {0} {1}", Environment.OSVersion.VersionString, Environment.Is64BitOperatingSystem ? "x64" : "x86"),
string.Format("\tHost Product: {0} {1}", Application.ProductName, Environment.Is64BitProcess ? "x64" : "x86"),
string.Format("\tHost Version: {0}", Application.ProductVersion),
string.Format("\tHost Executable: {0}", Path.GetFileName(Application.ExecutablePath)),
$"\r\n\tRubberduck version {version} loading:",
$"\tOperating System: {Environment.OSVersion.VersionString} {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}",
$"\tHost Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}",
$"\tHost Version: {Application.ProductVersion}",
$"\tHost Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}", // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE
};
LogLevelHelper.SetDebugInfo(string.Join(Environment.NewLine, headers));
}
@@ -6,7 +6,8 @@
xmlns:about="clr-namespace:Rubberduck.UI.About"
mc:Ignorable="d"
d:DesignWidth="499"
d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}">
d:DataContext="{d:DesignInstance {x:Type about:AboutControlViewModel}, IsDesignTimeCreatable=False}"
KeyDown="OnKeyDownHandler">
<UserControl.Resources>
<BitmapImage x:Key="Ducky" UriSource="../../Resources/AboutBanner.png" />
<BitmapImage x:Key="RD" UriSource="../../Resources/Rubberduck.png" />
@@ -22,10 +23,19 @@
<RowDefinition Height="64" />
</Grid.RowDefinitions>

<Border Grid.Column="0" Grid.Row="0" Background="White" Margin="5,5,0,0">
<TextBlock Margin="5,10,5,10" Text="{Binding Version}" Foreground="Black"
FontWeight="Bold" FontSize="14"
VerticalAlignment="Top" HorizontalAlignment="Left" />
<Border Grid.Column="0" Grid.Row="0" Background="White" Margin="5,5,0,0"
MouseLeftButtonDown="CopyVersionInfo_MouseLeftButtonDown">
<StackPanel>
<TextBlock x:Name="Version"
Margin="5,10,5,0" Text="{Binding Version}" Foreground="Black"
FontWeight="Bold" FontSize="14"
VerticalAlignment="Center" HorizontalAlignment="Center"/>
<Label Name="CopyVersionInfo"
Foreground="Gray"
FontSize="8"
HorizontalAlignment="Center"
Content="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=AboutWindow_CopyVersionLabel}"/>
</StackPanel>
</Border>

<Border Grid.Column="1" Grid.Row="0" Background="White" Margin="0,5,5,0">
@@ -1,4 +1,10 @@
namespace Rubberduck.UI.About
using System.Windows;
using System.Windows.Input;
using System;
using System.IO;
using Application = System.Windows.Forms.Application;

namespace Rubberduck.UI.About
{
/// <summary>
/// Interaction logic for AboutControl.xaml
@@ -9,5 +15,32 @@ public AboutControl()
{
InitializeComponent();
}

private void OnKeyDownHandler(object sender, KeyEventArgs e)
{
bool isControlCPressed = (Keyboard.IsKeyDown(Key.C) && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)));
if (isControlCPressed)
{
CopyVersionInfoToClipboard();
}
}

private void CopyVersionInfo_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
CopyVersionInfoToClipboard();
}

private void CopyVersionInfoToClipboard()
{
var sb = new System.Text.StringBuilder();
sb.AppendLine($"Rubberduck version: {this.Version.Text}");
sb.AppendLine($"Operating System: {Environment.OSVersion.VersionString}, {(Environment.Is64BitOperatingSystem ? "x64" : "x86")}");
sb.AppendLine($"Host Product: {Application.ProductName} {(Environment.Is64BitProcess ? "x64" : "x86")}");
sb.AppendLine($"Host Version: {Application.ProductVersion}");
sb.AppendFormat($"Host Executable: {Path.GetFileName(Application.ExecutablePath).ToUpper()}"); // .ToUpper() used to convert ExceL.EXE -> EXCEL.EXE

Clipboard.SetText(sb.ToString());
System.Windows.MessageBox.Show(RubberduckUI.AboutWindow_CopyVersionMessage, RubberduckUI.AboutWindow_CopyVersionCaption);
}
}
}
@@ -16,13 +16,7 @@ public AboutControlViewModel(IVersionCheck version)
_version = version;
}

public string Version
{
get
{
return string.Format(RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);
}
}
public string Version => string.Format(RubberduckUI.Rubberduck_AboutBuild, _version.CurrentVersion);

private CommandBase _uriCommand;
public CommandBase UriCommand
@@ -15,7 +15,7 @@ public CodeExplorerControl()
InitializeComponent();
}

private CodeExplorerViewModel ViewModel { get { return DataContext as CodeExplorerViewModel; } }
private CodeExplorerViewModel ViewModel => DataContext as CodeExplorerViewModel;

private void TreeView_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
@@ -52,20 +52,17 @@ private Declaration GetDeclaration(CodeExplorerItemViewModel node)

private string GetFolder(CodeExplorerItemViewModel node)
{
if (node == null)
switch (node)
{
return DefaultFolder;
case null:
return DefaultFolder;
case ICodeExplorerDeclarationViewModel declarationNode:
return string.IsNullOrEmpty(declarationNode.Declaration.CustomFolder)
? DefaultFolder
: declarationNode.Declaration.CustomFolder.Replace("\"", string.Empty);
default:
return ((CodeExplorerCustomFolderViewModel)node).FullPath;
}

var declarationNode = node as ICodeExplorerDeclarationViewModel;
if (declarationNode != null)
{
return string.IsNullOrEmpty(declarationNode.Declaration.CustomFolder)
? DefaultFolder
: declarationNode.Declaration.CustomFolder.Replace("\"", string.Empty);
}

return ((CodeExplorerCustomFolderViewModel)node).FullPath;
}
}
}
@@ -11,8 +11,8 @@ public class BindableSelectedItemBehavior : Behavior<TreeView>
{
public object SelectedItem
{
get { return (object) GetValue(SelectedItemProperty); }
set { SetValue(SelectedItemProperty, value); }
get => (object) GetValue(SelectedItemProperty);
set => SetValue(SelectedItemProperty, value);
}

public static readonly DependencyProperty SelectedItemProperty =
@@ -21,8 +21,7 @@ public object SelectedItem

private static void OnSelectedItemChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
{
var item = e.NewValue as TreeViewItem;
if (item != null)
if (e.NewValue is TreeViewItem item)
{
item.SetValue(TreeViewItem.IsSelectedProperty, true);
}
@@ -31,8 +31,8 @@ public BindableTextEditor()

public new string Text
{
get { return base.Text; }
set { base.Text = value; }
get => base.Text;
set => base.Text = value;
}

public static readonly DependencyProperty TextProperty =
@@ -50,10 +50,7 @@ protected override void OnTextChanged(EventArgs e)

public void RaisePropertyChanged(string property)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(property));
}
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property));
}

public event PropertyChangedEventHandler PropertyChanged;
@@ -9,9 +9,8 @@ public class DeclarationTypeToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DeclarationType)
if (value is DeclarationType type)
{
var type = (DeclarationType)value;
var text = RubberduckUI.ResourceManager.GetString("DeclarationType_" + type, CultureInfo.CurrentUICulture) ?? string.Empty;
return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text);
}
@@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;

namespace Rubberduck.UI.Controls
{
@@ -10,8 +10,8 @@ public partial class GroupingGrid

public bool ShowGroupingItemCount
{
get { return (bool) GetValue(ShowGroupingItemCountProperty); }
set { SetValue(ShowGroupingItemCountProperty, value); }
get => (bool) GetValue(ShowGroupingItemCountProperty);
set => SetValue(ShowGroupingItemCountProperty, value);
}

public GroupingGrid()
@@ -21,11 +21,11 @@ public GroupingGrid()

private void GroupingGridItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var context = DataContext as INavigateSelection;
if (context == null)
if (!(DataContext is INavigateSelection context))
{
return;
}

var selection = context.SelectedItem;
if (selection != null)
{
@@ -30,9 +30,8 @@ public static string GetGroupName(MenuItem element)
private static void OnGroupNameChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
//Add an entry to the group name collection
var menuItem = d as MenuItem;

if (menuItem != null)
if (d is MenuItem menuItem)
{
var newGroupName = e.NewValue.ToString();
var oldGroupName = e.OldValue.ToString();
@@ -44,16 +43,18 @@ private static void OnGroupNameChanged(DependencyObject d, DependencyPropertyCha
else
{
//Switching to a new group
if (newGroupName != oldGroupName)
if (newGroupName == oldGroupName)
{
if (!string.IsNullOrEmpty(oldGroupName))
{
//Remove the old group mapping
RemoveCheckboxFromGrouping(menuItem);
}
ElementToGroupNames.Add(menuItem, e.NewValue.ToString());
menuItem.Checked += MenuItemChecked;
return;
}

if (!string.IsNullOrEmpty(oldGroupName))
{
//Remove the old group mapping
RemoveCheckboxFromGrouping(menuItem);
}
ElementToGroupNames.Add(menuItem, e.NewValue.ToString());
menuItem.Checked += MenuItemChecked;
}
}
}
@@ -65,7 +66,7 @@ private static void RemoveCheckboxFromGrouping(MenuItem checkBox)
}


static void MenuItemChecked(object sender, RoutedEventArgs e)
private static void MenuItemChecked(object sender, RoutedEventArgs e)
{
var menuItem = e.OriginalSource as MenuItem;
foreach (var item in ElementToGroupNames)
@@ -14,30 +14,17 @@ public partial class NumberPicker : IDataErrorInfo

public int NumValue
{
get
{
return (int)GetValue(NumValueProperty);
}
get => (int)GetValue(NumValueProperty);
set
{
SetValue(NumValueProperty, value);
OnPropertyChanged(new DependencyPropertyChangedEventArgs(NumValueProperty, NumValue - 1, NumValue));
}
}

private int _minNumber = int.MinValue;
public int MinNumber
{
get { return _minNumber; }
set { _minNumber = value; }
}
public int MinNumber { get; set; } = int.MinValue;

private int _maxNumber = int.MaxValue;
public int MaxNumber
{
get { return _maxNumber; }
set { _maxNumber = value; }
}
public int MaxNumber { get; set; } = int.MaxValue;

public NumberPicker()
{
@@ -6,29 +6,31 @@ namespace Rubberduck.UI.Controls
public class SearchResultItem : ViewModelBase, INavigateSource
{
private readonly NavigateCodeEventArgs _navigateArgs;
private readonly Declaration _parentScopeDeclaration;
private string _resultText;

public SearchResultItem(Declaration parentScopeDeclaration, NavigateCodeEventArgs navigationInfo, string resultText)
{
_navigateArgs = navigationInfo;
_parentScopeDeclaration = parentScopeDeclaration;
ParentScope = parentScopeDeclaration;
_resultText = resultText;
}

public Declaration ParentScope { get { return _parentScopeDeclaration; } }
public Selection Selection { get { return _navigateArgs.Selection; } }
public Declaration ParentScope { get; }

public Selection Selection => _navigateArgs.Selection;

public string ResultText
{
get { return _resultText; }
get => _resultText;
set
{
if (_resultText != value)
if (_resultText == value)
{
_resultText = value;
OnPropertyChanged();
return;
}

_resultText = value;
OnPropertyChanged();
}
}

@@ -10,7 +10,7 @@ public sealed class SearchResultPresenterInstanceManager : IDisposable
{
private readonly IVBE _vbe;
private readonly IAddIn _addin;
private SearchResultWindow _view;
private readonly SearchResultWindow _view;

public SearchResultPresenterInstanceManager(IVBE vbe, IAddIn addin)
{

0 comments on commit 4e5cd9d

Please sign in to comment.
You can’t perform that action at this time.