From 8f3ce714a288c047a0d6f105bf662d4687c36ec6 Mon Sep 17 00:00:00 2001 From: Travis Nickles Date: Thu, 7 Mar 2019 13:35:13 -0600 Subject: [PATCH] Removed unwanted boxing for AdvancedColorDialog --- DS4Windows/DS4Forms/AdvancedColorDialog.cs | 2 +- DS4Windows/DS4Forms/DS4Form.cs | 5 ++--- DS4Windows/DS4Forms/KBM360.cs | 5 ++--- DS4Windows/DS4Forms/Options.cs | 5 ++--- DS4Windows/DS4Forms/RecordBox.cs | 5 ++--- DS4Windows/DS4Forms/SpecActions.cs | 5 ++--- 6 files changed, 11 insertions(+), 16 deletions(-) diff --git a/DS4Windows/DS4Forms/AdvancedColorDialog.cs b/DS4Windows/DS4Forms/AdvancedColorDialog.cs index 61764b5..f5e8749 100644 --- a/DS4Windows/DS4Forms/AdvancedColorDialog.cs +++ b/DS4Windows/DS4Forms/AdvancedColorDialog.cs @@ -132,7 +132,7 @@ namespace DS4Windows private const int WM_INITDIALOG = 0x0110; private List EditWindows = null; - public delegate void ColorUpdateHandler(object sender, EventArgs e); + public delegate void ColorUpdateHandler(Color colValue, EventArgs e); public event ColorUpdateHandler OnUpdateColor; [DllImport("user32.dll", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)] diff --git a/DS4Windows/DS4Forms/DS4Form.cs b/DS4Windows/DS4Forms/DS4Form.cs index b712c8e..c9f2f97 100644 --- a/DS4Windows/DS4Forms/DS4Form.cs +++ b/DS4Windows/DS4Forms/DS4Form.cs @@ -2359,11 +2359,10 @@ Properties.Resources.DS4Update, MessageBoxButtons.YesNo, MessageBoxIcon.Question DS4LightBar.forcelight[currentCustomLed] = false; } - private void advColor_CustomColorUpdate(object sender, EventArgs e) + private void advColor_CustomColorUpdate(Color color, EventArgs e) { - if (sender is Color && currentCustomLed < 4) + if (currentCustomLed < 4) { - Color color = (Color)sender; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4LightBar.forcedColor[currentCustomLed] = dcolor; DS4LightBar.forcedFlash[currentCustomLed] = 0; diff --git a/DS4Windows/DS4Forms/KBM360.cs b/DS4Windows/DS4Forms/KBM360.cs index c4f710d..c7bf004 100644 --- a/DS4Windows/DS4Forms/KBM360.cs +++ b/DS4Windows/DS4Forms/KBM360.cs @@ -458,11 +458,10 @@ namespace DS4Windows DS4LightBar.forcelight[device] = false; } - private void advColorDialog_OnUpdateColor(object sender, EventArgs e) + private void advColorDialog_OnUpdateColor(Color color, EventArgs e) { - if (sender is Color && device < 4) + if (device < 4) { - Color color = (Color)sender; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedFlash[device] = 0; diff --git a/DS4Windows/DS4Forms/Options.cs b/DS4Windows/DS4Forms/Options.cs index b923282..fa68bbc 100644 --- a/DS4Windows/DS4Forms/Options.cs +++ b/DS4Windows/DS4Forms/Options.cs @@ -1431,11 +1431,10 @@ namespace DS4Windows ChargingColor[device] = new DS4Color(chargingBackColor); } - private void advColorDialog_OnUpdateColor(object sender, EventArgs e) + private void advColorDialog_OnUpdateColor(Color color, EventArgs e) { - if (sender is Color && device < 4) + if (device < 4) { - Color color = (Color)sender; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedFlash[device] = 0; diff --git a/DS4Windows/DS4Forms/RecordBox.cs b/DS4Windows/DS4Forms/RecordBox.cs index 112e12b..479f078 100644 --- a/DS4Windows/DS4Forms/RecordBox.cs +++ b/DS4Windows/DS4Forms/RecordBox.cs @@ -1356,11 +1356,10 @@ namespace DS4Windows cHMacro.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize); } - private void advColorDialog_OnUpdateColor(object sender, EventArgs e) + private void advColorDialog_OnUpdateColor(Color color, EventArgs e) { - if (sender is Color && Program.rootHub.DS4Controllers[0] != null) + if (Program.rootHub.DS4Controllers[0] != null) { - Color color = (Color)sender; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4LightBar.forcedColor[0] = dcolor; DS4LightBar.forcedFlash[0] = 0; diff --git a/DS4Windows/DS4Forms/SpecActions.cs b/DS4Windows/DS4Forms/SpecActions.cs index a1f5ed5..da4c6f4 100644 --- a/DS4Windows/DS4Forms/SpecActions.cs +++ b/DS4Windows/DS4Forms/SpecActions.cs @@ -491,11 +491,10 @@ namespace DS4Windows e.Graphics.FillRectangle(linGrBrush, 0, 0, pBGraident.Width, pBGraident.Height); } - private void advColorDialog_OnUpdateColor(object sender, EventArgs e) + private void advColorDialog_OnUpdateColor(Color color, EventArgs e) { - if (sender is Color && device < 4) + if (device < 4) { - Color color = (Color)sender; DS4Color dcolor = new DS4Color { red = color.R, green = color.G, blue = color.B }; DS4LightBar.forcedColor[device] = dcolor; DS4LightBar.forcedFlash[device] = 0;