diff --git a/GitDiffMargin.Extension/GitDiffMargin.Extension.csproj b/GitDiffMargin.Extension/GitDiffMargin.Extension.csproj
index 8f8af803..38bac6d5 100644
--- a/GitDiffMargin.Extension/GitDiffMargin.Extension.csproj
+++ b/GitDiffMargin.Extension/GitDiffMargin.Extension.csproj
@@ -34,7 +34,6 @@
-
diff --git a/GitDiffMargin.Extension/Properties/AssemblyInfo.cs b/GitDiffMargin.Extension/Properties/AssemblyInfo.cs
index fafd617f..3ded015f 100644
--- a/GitDiffMargin.Extension/Properties/AssemblyInfo.cs
+++ b/GitDiffMargin.Extension/Properties/AssemblyInfo.cs
@@ -9,10 +9,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("e4701f35-8030-418e-8e8c-6ae72e229138")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.Extras.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.Platform.dll")]
[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GitDiffMargin.Shim.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\LibGit2Sharp.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\CommonServiceLocator.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Windows.Interactivity.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\LibGit2Sharp.dll")]
\ No newline at end of file
diff --git a/GitDiffMargin.Shared/GitDiffMargin.Shared.projitems b/GitDiffMargin.Shared/GitDiffMargin.Shared.projitems
index 6473b1ac..79f11ae0 100644
--- a/GitDiffMargin.Shared/GitDiffMargin.Shared.projitems
+++ b/GitDiffMargin.Shared/GitDiffMargin.Shared.projitems
@@ -61,8 +61,11 @@
+
+
+
diff --git a/GitDiffMargin.Shared/GitDiffMarginCommandHandler.cs b/GitDiffMargin.Shared/GitDiffMarginCommandHandler.cs
index 276f4aa9..05ecf39a 100644
--- a/GitDiffMargin.Shared/GitDiffMarginCommandHandler.cs
+++ b/GitDiffMargin.Shared/GitDiffMarginCommandHandler.cs
@@ -3,8 +3,7 @@ namespace GitDiffMargin
using System;
using System.Linq;
using System.Windows.Input;
- using GalaSoft.MvvmLight.Command;
- using GitDiffMargin.ViewModel;
+ using ViewModel;
using Microsoft.VisualStudio.Editor;
using Microsoft.VisualStudio.Text.Editor;
using IVsTextView = Microsoft.VisualStudio.TextManager.Interop.IVsTextView;
@@ -60,7 +59,7 @@ protected override OLECMDF QueryCommandStatus(ref Guid commandGroup, uint comman
EditorDiffViewModel diffViewModel = viewModel.DiffViewModels.OfType().FirstOrDefault(i => i.ShowPopup);
if (diffViewModel != null)
{
- RelayCommand command = (GitDiffMarginCommand)commandId == GitDiffMarginCommand.NextChange ? viewModel.NextChangeCommand : viewModel.PreviousChangeCommand;
+ ICommand command = (GitDiffMarginCommand)commandId == GitDiffMarginCommand.NextChange ? viewModel.NextChangeCommand : viewModel.PreviousChangeCommand;
if (command.CanExecute(diffViewModel))
return OLECMDF.OLECMDF_SUPPORTED | OLECMDF.OLECMDF_ENABLED;
else
@@ -148,7 +147,7 @@ protected override bool HandlePreExec(ref Guid commandGroup, uint commandId, OLE
if (viewModel == null)
return false;
- RelayCommand command = (GitDiffMarginCommand)commandId == GitDiffMarginCommand.NextChange ? viewModel.NextChangeCommand : viewModel.PreviousChangeCommand;
+ ICommand command = (GitDiffMarginCommand)commandId == GitDiffMarginCommand.NextChange ? viewModel.NextChangeCommand : viewModel.PreviousChangeCommand;
// First look for a diff already showing a popup
if (diffViewModel != null)
diff --git a/GitDiffMargin.Shared/GitDiffMarginPackage.cs b/GitDiffMargin.Shared/GitDiffMarginPackage.cs
index caa268dd..d599344c 100644
--- a/GitDiffMargin.Shared/GitDiffMarginPackage.cs
+++ b/GitDiffMargin.Shared/GitDiffMarginPackage.cs
@@ -1,6 +1,5 @@
namespace GitDiffMargin
{
- using System;
using System.Runtime.InteropServices;
using Microsoft.VisualStudio.Shell;
diff --git a/GitDiffMargin.Shared/ViewModel/DiffMarginViewModelBase.cs b/GitDiffMargin.Shared/ViewModel/DiffMarginViewModelBase.cs
index 5f10ceeb..efa8d0a6 100644
--- a/GitDiffMargin.Shared/ViewModel/DiffMarginViewModelBase.cs
+++ b/GitDiffMargin.Shared/ViewModel/DiffMarginViewModelBase.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Linq;
-using GalaSoft.MvvmLight;
using GitDiffMargin.Core;
using GitDiffMargin.Git;
diff --git a/GitDiffMargin.Shared/ViewModel/DiffViewModel.cs b/GitDiffMargin.Shared/ViewModel/DiffViewModel.cs
index aa03fe32..ef33ac41 100644
--- a/GitDiffMargin.Shared/ViewModel/DiffViewModel.cs
+++ b/GitDiffMargin.Shared/ViewModel/DiffViewModel.cs
@@ -1,7 +1,6 @@
using System;
using System.Windows;
using System.Windows.Media;
-using GalaSoft.MvvmLight;
using GitDiffMargin.Core;
using GitDiffMargin.Git;
@@ -31,7 +30,7 @@ public double Height
set
{
_height = value;
- RaisePropertyChanged(() => Height);
+ RaisePropertyChanged(nameof(Height));
}
}
@@ -41,7 +40,7 @@ public double Top
set
{
_top = value;
- RaisePropertyChanged(() => Top);
+ RaisePropertyChanged(nameof(Top));
}
}
@@ -83,7 +82,7 @@ public virtual bool IsVisible
{
get { return _isVisible; }
set { _isVisible = value;
- RaisePropertyChanged(() => IsVisible);}
+ RaisePropertyChanged(nameof(IsVisible));}
}
public double ScaleFactor => MarginCore.ScaleFactor;
@@ -115,7 +114,7 @@ public override void Cleanup()
private void HandleBrushesChanged(object sender, EventArgs e)
{
- RaisePropertyChanged(() => DiffBrush);
+ RaisePropertyChanged(nameof(DiffBrush));
}
protected virtual void UpdateDimensions()
diff --git a/GitDiffMargin.Shared/ViewModel/EditorDiffMarginViewModel.cs b/GitDiffMargin.Shared/ViewModel/EditorDiffMarginViewModel.cs
index a52b39a6..552dfda4 100644
--- a/GitDiffMargin.Shared/ViewModel/EditorDiffMarginViewModel.cs
+++ b/GitDiffMargin.Shared/ViewModel/EditorDiffMarginViewModel.cs
@@ -2,7 +2,7 @@
using System;
using System.Linq;
-using GalaSoft.MvvmLight.Command;
+using System.Windows.Input;
using GitDiffMargin.Core;
using GitDiffMargin.Git;
@@ -13,8 +13,8 @@ namespace GitDiffMargin.ViewModel
internal class EditorDiffMarginViewModel : DiffMarginViewModelBase
{
private readonly Action _updateDiffDimensions;
- private RelayCommand _previousChangeCommand;
- private RelayCommand _nextChangeCommand;
+ private ICommand _previousChangeCommand;
+ private ICommand _nextChangeCommand;
internal EditorDiffMarginViewModel(IMarginCore marginCore, Action updateDiffDimensions) :
base(marginCore)
@@ -25,12 +25,12 @@ internal EditorDiffMarginViewModel(IMarginCore marginCore, Action PreviousChangeCommand
+ public ICommand PreviousChangeCommand
{
get { return _previousChangeCommand ?? (_previousChangeCommand = new RelayCommand(PreviousChange, PreviousChangeCanExecute)); }
}
- public RelayCommand NextChangeCommand
+ public ICommand NextChangeCommand
{
get { return _nextChangeCommand ?? (_nextChangeCommand = new RelayCommand(NextChange, NextChangeCanExecute)); }
}
diff --git a/GitDiffMargin.Shared/ViewModel/EditorDiffViewModel.cs b/GitDiffMargin.Shared/ViewModel/EditorDiffViewModel.cs
index 7477daa1..79fcc3d2 100644
--- a/GitDiffMargin.Shared/ViewModel/EditorDiffViewModel.cs
+++ b/GitDiffMargin.Shared/ViewModel/EditorDiffViewModel.cs
@@ -6,13 +6,11 @@
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
-using GalaSoft.MvvmLight.Command;
using GitDiffMargin.Core;
using GitDiffMargin.Git;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
-using IOleCommandTarget = Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget;
#endregion
@@ -188,8 +186,8 @@ public bool ShowPopup
ErrorHandler.CallWithCOMConvention(() => toolbarTrayHost.Close());
}
- RaisePropertyChanged(() => ShowPopup);
- RaisePropertyChanged(() => ToolBarTray);
+ RaisePropertyChanged(nameof(ShowPopup));
+ RaisePropertyChanged(nameof(ToolBarTray));
}
}
@@ -202,7 +200,7 @@ public bool IsDiffTextVisible
{
if (value == _isDiffTextVisible) return;
_isDiffTextVisible = value;
- RaisePropertyChanged(() => IsDiffTextVisible);
+ RaisePropertyChanged(nameof(IsDiffTextVisible));
}
}
diff --git a/GitDiffMargin.Shared/ViewModel/RelayCommand.cs b/GitDiffMargin.Shared/ViewModel/RelayCommand.cs
new file mode 100644
index 00000000..7cb6b304
--- /dev/null
+++ b/GitDiffMargin.Shared/ViewModel/RelayCommand.cs
@@ -0,0 +1,123 @@
+//
+// Copyright © GalaSoft Laurent Bugnion 2009-2011
+//
+// ****************************************************************************
+// Laurent Bugnion
+// laurent@galasoft.ch
+// 22.4.2009
+// GalaSoft.MvvmLight
+// http://www.galasoft.ch
+//
+// See license.txt in this project or http://www.galasoft.ch/license_MIT.txt
+//
+// BL0008
+// ****************************************************************************
+// This class was developed by Josh Smith (http://joshsmithonwpf.wordpress.com) and
+// slightly modified with his permission.
+// ****************************************************************************
+
+using System;
+using System.Diagnostics;
+using System.Diagnostics.CodeAnalysis;
+using System.Windows.Input;
+
+namespace GitDiffMargin.ViewModel
+
+{
+ ///
+ /// A command whose sole purpose is to relay its functionality to other
+ /// objects by invoking delegates. The default return value for the CanExecute
+ /// method is 'true'. This class does not allow you to accept command parameters in the
+ /// Execute and CanExecute callback methods.
+ ///
+ ////[ClassInfo(typeof(RelayCommand),
+ //// VersionString = "3.0.0.0",
+ //// DateString = "201003041420",
+ //// Description = "A command whose sole purpose is to relay its functionality to other objects by invoking delegates.",
+ //// UrlContacts = "http://www.galasoft.ch/contact_en.html",
+ //// Email = "laurent@galasoft.ch")]
+ public class RelayCommand : ICommand
+ {
+ private readonly Action _execute;
+
+ private readonly Func _canExecute;
+
+ ///
+ /// Initializes a new instance of the RelayCommand class that
+ /// can always execute.
+ ///
+ /// The execution logic.
+ /// If the execute argument is null.
+ public RelayCommand(Action execute)
+ : this(execute, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the RelayCommand class.
+ ///
+ /// The execution logic.
+ /// The execution status logic.
+ /// If the execute argument is null.
+ public RelayCommand(Action execute, Func canExecute)
+ {
+ if (execute == null)
+ {
+ throw new ArgumentNullException("execute");
+ }
+
+ _execute = execute;
+ _canExecute = canExecute;
+ }
+
+ ///
+ /// Occurs when changes occur that affect whether the command should execute.
+ ///
+ public event EventHandler CanExecuteChanged
+ {
+ add
+ {
+ if (_canExecute != null)
+ {
+ CommandManager.RequerySuggested += value;
+ }
+ }
+
+ remove
+ {
+ if (_canExecute != null)
+ {
+ CommandManager.RequerySuggested -= value;
+ }
+ }
+ }
+
+ ///
+ /// Raises the event.
+ ///
+ public void RaiseCanExecuteChanged()
+ {
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+ ///
+ /// Defines the method that determines whether the command can execute in its current state.
+ ///
+ /// This parameter will always be ignored.
+ /// true if this command can be executed; otherwise, false.
+ [DebuggerStepThrough]
+ public bool CanExecute(object parameter)
+ {
+ return _canExecute == null ? true : _canExecute();
+ }
+
+ ///
+ /// Defines the method to be called when the command is invoked.
+ ///
+ /// This parameter will always be ignored.
+ public void Execute(object parameter)
+ {
+ _execute();
+ }
+ }
+}
\ No newline at end of file
diff --git a/GitDiffMargin.Shared/ViewModel/RelayCommandGeneric.cs b/GitDiffMargin.Shared/ViewModel/RelayCommandGeneric.cs
new file mode 100644
index 00000000..133559d4
--- /dev/null
+++ b/GitDiffMargin.Shared/ViewModel/RelayCommandGeneric.cs
@@ -0,0 +1,118 @@
+// ****************************************************************************
+//
+// Copyright © GalaSoft Laurent Bugnion 2009-2011
+//
+// ****************************************************************************
+// Laurent Bugnion
+// laurent@galasoft.ch
+// 22.4.2009
+// GalaSoft.MvvmLight
+// http://www.galasoft.ch
+//
+// See license.txt in this project or http://www.galasoft.ch/license_MIT.txt
+//
+// ****************************************************************************
+// This class was developed by Josh Smith (http://joshsmithonwpf.wordpress.com) and
+// slightly modified with his permission.
+// ****************************************************************************
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using System.Windows.Input;
+
+namespace GitDiffMargin.ViewModel
+{
+ ///
+ /// A generic command whose sole purpose is to relay its functionality to other
+ /// objects by invoking delegates. The default return value for the CanExecute
+ /// method is 'true'. This class allows you to accept command parameters in the
+ /// Execute and CanExecute callback methods.
+ ///
+ /// The type of the command parameter.
+ //// [ClassInfo(typeof(RelayCommand)]
+ public class RelayCommand : ICommand
+ {
+ private readonly Action _execute;
+
+ private readonly Predicate _canExecute;
+
+ ///
+ /// Initializes a new instance of the RelayCommand class that
+ /// can always execute.
+ ///
+ /// The execution logic.
+ /// If the execute argument is null.
+ public RelayCommand(Action execute)
+ : this(execute, null)
+ {
+ }
+
+ ///
+ /// Initializes a new instance of the RelayCommand class.
+ ///
+ /// The execution logic.
+ /// The execution status logic.
+ /// If the execute argument is null.
+ public RelayCommand(Action execute, Predicate canExecute)
+ {
+ if (execute == null)
+ {
+ throw new ArgumentNullException("execute");
+ }
+
+ _execute = execute;
+ _canExecute = canExecute;
+ }
+
+ ///
+ /// Occurs when changes occur that affect whether the command should execute.
+ ///
+ public event EventHandler CanExecuteChanged
+ {
+ add
+ {
+ if (_canExecute != null)
+ {
+ CommandManager.RequerySuggested += value;
+ }
+ }
+
+ remove
+ {
+ if (_canExecute != null)
+ {
+ CommandManager.RequerySuggested -= value;
+ }
+ }
+ }
+
+ ///
+ /// Raises the event.
+ ///
+ public void RaiseCanExecuteChanged()
+ {
+ CommandManager.InvalidateRequerySuggested();
+ }
+
+ ///
+ /// Defines the method that determines whether the command can execute in its current state.
+ ///
+ /// Data used by the command. If the command does not require data
+ /// to be passed, this object can be set to a null reference
+ /// true if this command can be executed; otherwise, false.
+ public bool CanExecute(object parameter)
+ {
+ return _canExecute == null ? true : _canExecute((T)parameter);
+ }
+
+ ///
+ /// Defines the method to be called when the command is invoked.
+ ///
+ /// Data used by the command. If the command does not require data
+ /// to be passed, this object can be set to a null reference
+ public void Execute(object parameter)
+ {
+ _execute((T)parameter);
+ }
+ }
+}
\ No newline at end of file
diff --git a/GitDiffMargin.Shared/ViewModel/ViewModelBase.cs b/GitDiffMargin.Shared/ViewModel/ViewModelBase.cs
new file mode 100644
index 00000000..3a101464
--- /dev/null
+++ b/GitDiffMargin.Shared/ViewModel/ViewModelBase.cs
@@ -0,0 +1,20 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+
+namespace GitDiffMargin.ViewModel
+{
+ internal abstract class ViewModelBase : INotifyPropertyChanged
+
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected void RaisePropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+
+ public virtual void Cleanup()
+ {
+ }
+ }
+}
\ No newline at end of file
diff --git a/GitDiffMargin/GitDiffMargin.15.csproj b/GitDiffMargin/GitDiffMargin.15.csproj
index 8d49b82b..5a0b5039 100644
--- a/GitDiffMargin/GitDiffMargin.15.csproj
+++ b/GitDiffMargin/GitDiffMargin.15.csproj
@@ -37,7 +37,6 @@
-
diff --git a/GitDiffMargin/GitDiffMargin.16.csproj b/GitDiffMargin/GitDiffMargin.16.csproj
index e3f85879..5d5244b7 100644
--- a/GitDiffMargin/GitDiffMargin.16.csproj
+++ b/GitDiffMargin/GitDiffMargin.16.csproj
@@ -36,7 +36,6 @@
-
diff --git a/GitDiffMargin/GitDiffMargin.17.csproj b/GitDiffMargin/GitDiffMargin.17.csproj
index e52da8a1..0e3f2442 100644
--- a/GitDiffMargin/GitDiffMargin.17.csproj
+++ b/GitDiffMargin/GitDiffMargin.17.csproj
@@ -36,7 +36,6 @@
-
diff --git a/GitDiffMargin/Properties/AssemblyInfo.cs b/GitDiffMargin/Properties/AssemblyInfo.cs
index 0161c518..61b96ba4 100644
--- a/GitDiffMargin/Properties/AssemblyInfo.cs
+++ b/GitDiffMargin/Properties/AssemblyInfo.cs
@@ -9,9 +9,4 @@
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.Extras.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\GalaSoft.MvvmLight.Platform.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\LibGit2Sharp.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\CommonServiceLocator.dll")]
-[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.Windows.Interactivity.dll")]
+[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\LibGit2Sharp.dll")]
\ No newline at end of file
diff --git a/GitDiffMargin/View/EditorDiffMarginControl.xaml.cs b/GitDiffMargin/View/EditorDiffMarginControl.xaml.cs
index 0348c2bd..b64b9045 100644
--- a/GitDiffMargin/View/EditorDiffMarginControl.xaml.cs
+++ b/GitDiffMargin/View/EditorDiffMarginControl.xaml.cs
@@ -3,10 +3,8 @@
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
-using System.Windows.Media;
using System.Windows.Threading;
using GitDiffMargin.ViewModel;
-using Microsoft.VisualStudio.Shell.Interop;
namespace GitDiffMargin.View
{
diff --git a/GitDiffMargin/View/ScrollDiffMarginControl.xaml.cs b/GitDiffMargin/View/ScrollDiffMarginControl.xaml.cs
index 42eb8594..7f0ed07e 100644
--- a/GitDiffMargin/View/ScrollDiffMarginControl.xaml.cs
+++ b/GitDiffMargin/View/ScrollDiffMarginControl.xaml.cs
@@ -1,6 +1,4 @@
-using System.Windows.Controls;
-
-namespace GitDiffMargin.View
+namespace GitDiffMargin.View
{
///
/// Interaction logic for ScrollDiffMarginControl.xaml