Removed unwanted boxing for AdvancedColorDialog

This commit is contained in:
Travis Nickles 2019-03-07 13:35:13 -06:00
parent 45485bb44d
commit 8f3ce714a2
6 changed files with 11 additions and 16 deletions

View File

@ -132,7 +132,7 @@ namespace DS4Windows
private const int WM_INITDIALOG = 0x0110;
private List<ApiWindow> 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)]

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;