//-----------------------------------------------------------------------
//
// Copyright © 2012 Nils Hammar. All rights reserved.
//
//-----------------------------------------------------------------------
/*
* Software to access vehicle information via the OBD-II connector.
*
* Copyright © 2012 Nils Hammar
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Alternative licensing is possible, see the licensing document.
*
* The above text may not be removed or modified.
*/
namespace Gauges.TelltalePanel
{
using System;
using System.Drawing;
using System.Windows.Forms;
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1611:ElementParametersMustBeDocumented", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1122:UseStringEmptyForEmptyStrings", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1202:ElementsMustBeOrderedByAccess", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1401:FieldsMustBePrivate", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:PrefixLocalCallsWithThis", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:AccessModifierMustBeDeclared", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:ClosingCurlyBracketMustBeFollowedByBlankLine", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1600:ElementsMustBeDocumented", Justification = "Tool Generated.")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1601:PartialElementsMustBeDocumented", Justification = "Tool Generated.")]
public partial class ColorSelector : Form
{
public Color Color { get; private set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "1", Justification = "Reviewed.")]
public ColorSelector(Color oldColor, PaletteCreator palette)
{
this.InitializeComponent();
this.pictureBox1.BackColor = palette.paletteFlashOn.Entries[1];
this.pictureBox2.BackColor = palette.paletteFlashOn.Entries[2];
this.pictureBox3.BackColor = palette.paletteFlashOn.Entries[3];
this.pictureBox4.BackColor = palette.paletteFlashOn.Entries[4];
this.pictureBox5.BackColor = palette.paletteFlashOn.Entries[5];
this.pictureBox6.BackColor = palette.paletteFlashOn.Entries[6];
this.pictureBox7.BackColor = palette.paletteFlashOn.Entries[7];
this.pictureBox1.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox2.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox3.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox4.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox5.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox6.Click += new System.EventHandler(this.pictureBox_Click);
this.pictureBox7.Click += new System.EventHandler(this.pictureBox_Click);
Color = oldColor;
if (oldColor != null)
{
this.currentColor.BackColor = oldColor;
this.newColor.BackColor = oldColor;
}
}
private void pictureBox_Click(object sender, EventArgs e)
{
PictureBox box = (PictureBox)sender;
this.newColor.BackColor = box.BackColor;
}
private void okButton_Click(object sender, EventArgs e)
{
Color = this.newColor.BackColor;
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
private void cancelButton_Click(object sender, EventArgs e)
{
this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
}
}
}