diff --git a/src/Calculator/Utils/DelegateCommandUtils.cs b/src/Calculator/Utils/DelegateCommandUtils.cs index 562b1c5e0..d8e57aa3f 100644 --- a/src/Calculator/Utils/DelegateCommandUtils.cs +++ b/src/Calculator/Utils/DelegateCommandUtils.cs @@ -8,7 +8,7 @@ namespace CalculatorApp.Utils { static class DelegateCommandUtils { - public static DelegateCommand MakeDelegateCommand(TTarget target, DelegateCommandHandler handler) + public static DelegateCommand MakeDelegateCommand(TTarget target, Action handler) where TTarget : class { WeakReference weakTarget = new WeakReference(target); @@ -17,7 +17,7 @@ public static DelegateCommand MakeDelegateCommand(TTarget target, Deleg TTarget thatTarget = weakTarget.Target as TTarget; if(null != thatTarget) { - handler.Invoke(param); + handler.Invoke(thatTarget, param); } }); } diff --git a/src/Calculator/Views/Calculator.xaml.cs b/src/Calculator/Views/Calculator.xaml.cs index 58a5f2a99..86de43546 100644 --- a/src/Calculator/Views/Calculator.xaml.cs +++ b/src/Calculator/Views/Calculator.xaml.cs @@ -141,7 +141,11 @@ public System.Windows.Input.ICommand HistoryButtonPressed { if (donotuse_HistoryButtonPressed == null) { - donotuse_HistoryButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, ToggleHistoryFlyout); + donotuse_HistoryButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, + (that, param) => + { + that.ToggleHistoryFlyout(param); + }); } return donotuse_HistoryButtonPressed; } diff --git a/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cs b/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cs index 8c3c3f9ca..dff589bc5 100644 --- a/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cs +++ b/src/Calculator/Views/CalculatorScientificAngleButtons.xaml.cs @@ -48,7 +48,11 @@ public System.Windows.Input.ICommand ButtonPressed { if (donotuse_ButtonPressed == null) { - donotuse_ButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, OnAngleButtonPressed); + donotuse_ButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, + (that, param)=> + { + that.OnAngleButtonPressed(param); + }); } return donotuse_ButtonPressed; } diff --git a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cs b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cs index f345ae497..5ac5053bc 100644 --- a/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cs +++ b/src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.cs @@ -115,7 +115,11 @@ public System.Windows.Input.ICommand ZoomOutButtonPressed { if (donotuse_ZoomOutButtonPressed == null) { - donotuse_ZoomOutButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, OnZoomOutCommand); + donotuse_ZoomOutButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, + (that, param) => + { + that.OnZoomOutCommand(param); + }); } return donotuse_ZoomOutButtonPressed; } @@ -128,7 +132,11 @@ public System.Windows.Input.ICommand ZoomInButtonPressed { if (donotuse_ZoomInButtonPressed == null) { - donotuse_ZoomInButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, OnZoomInCommand); + donotuse_ZoomInButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, + (that, param) => + { + that.OnZoomInCommand(param); + }); } return donotuse_ZoomInButtonPressed; } diff --git a/src/Calculator/Views/StateTriggers/CalculatorProgrammerDisplayPanel.xaml.cs b/src/Calculator/Views/StateTriggers/CalculatorProgrammerDisplayPanel.xaml.cs index 6c7deb5d2..406e7ea12 100644 --- a/src/Calculator/Views/StateTriggers/CalculatorProgrammerDisplayPanel.xaml.cs +++ b/src/Calculator/Views/StateTriggers/CalculatorProgrammerDisplayPanel.xaml.cs @@ -1,4 +1,4 @@ -using System.Diagnostics; +using System.Diagnostics; using System.Windows.Input; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; @@ -17,7 +17,11 @@ public ICommand BitLengthButtonPressed { if (donotuse_BitLengthButtonPressed == null) { - donotuse_BitLengthButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, OnBitLengthButtonPressed); + donotuse_BitLengthButtonPressed = DelegateCommandUtils.MakeDelegateCommand(this, + (that, param) => + { + that.OnBitLengthButtonPressed(param); + }); } return donotuse_BitLengthButtonPressed; }