220 lines
9.0 KiB
C#
220 lines
9.0 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using BMS_D1000H.BMSConstData;
|
|
using BMS_D1000H.DataStructs;
|
|
using BMS_D1000H.Utils.Functions;
|
|
|
|
namespace BMS_D1000H
|
|
{
|
|
public partial class fmSystemSet : Form
|
|
{
|
|
#region DEFINES
|
|
|
|
const int SYS_PARAM_MAX = 1;
|
|
|
|
#endregion
|
|
|
|
#region VARIABLES
|
|
SmartX.SmartLabel[] lbParamName;
|
|
SmartX.SmartLabel[] lbCurrValue;
|
|
SmartX.SmartLabel[] lbNewValue;
|
|
SmartX.SmartButton[] btnSet;
|
|
|
|
DeviceDataSystem disBMSData;
|
|
|
|
#endregion
|
|
|
|
#region CONSTRUCTORS
|
|
public fmSystemSet()
|
|
{
|
|
InitializeComponent();
|
|
|
|
CreateComponent();
|
|
ResetControl();
|
|
|
|
tmrDisplay.Start();
|
|
}
|
|
|
|
private void CreateComponent()
|
|
{
|
|
lbParamName = new SmartX.SmartLabel[SYS_PARAM_MAX];
|
|
for (int i = 0; i < SYS_PARAM_MAX; i++)
|
|
{
|
|
lbParamName[i] = new SmartX.SmartLabel();
|
|
//lbParamName[i].BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
|
lbParamName[i].BackPictureBox = null;
|
|
lbParamName[i].BackPictureBox1 = null;
|
|
lbParamName[i].BackPictureBox2 = null;
|
|
lbParamName[i].BorderColor = System.Drawing.Color.Black;
|
|
lbParamName[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
lbParamName[i].Font = new System.Drawing.Font("Arial Black", 11F, System.Drawing.FontStyle.Bold);
|
|
lbParamName[i].InitVisible = true;
|
|
lbParamName[i].LineSpacing = 0F;
|
|
lbParamName[i].Location = new System.Drawing.Point(3, 92 + (i * 37));
|
|
lbParamName[i].Name = String.Format("ParamName{0}", i);
|
|
lbParamName[i].Size = new System.Drawing.Size(282, 35);
|
|
lbParamName[i].TabIndex = 70;
|
|
lbParamName[i].Text = SetSystemParameter.Name[i];
|
|
lbParamName[i].TextHAlign = SmartX.SmartLabel.TextHorAlign.Left;
|
|
lbParamName[i].TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
|
|
lbParamName[i].Wordwrap = false;
|
|
}
|
|
|
|
lbCurrValue = new SmartX.SmartLabel[SYS_PARAM_MAX];
|
|
for (int i = 0; i < SYS_PARAM_MAX; i++)
|
|
{
|
|
lbCurrValue[i] = new SmartX.SmartLabel();
|
|
//lbCurrValue[i].BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
|
lbCurrValue[i].BackPictureBox = null;
|
|
lbCurrValue[i].BackPictureBox1 = null;
|
|
lbCurrValue[i].BackPictureBox2 = null;
|
|
lbCurrValue[i].BorderColor = System.Drawing.Color.Black;
|
|
lbCurrValue[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
lbCurrValue[i].Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Bold);
|
|
lbCurrValue[i].InitVisible = true;
|
|
lbCurrValue[i].LineSpacing = 0F;
|
|
lbCurrValue[i].Location = new System.Drawing.Point(291, 92 + (i * 37));
|
|
lbCurrValue[i].Name = String.Format("ParamCurrValue{0}", i);
|
|
lbCurrValue[i].Size = new System.Drawing.Size(159, 35);
|
|
lbCurrValue[i].TabIndex = 70;
|
|
lbCurrValue[i].Text = "0 ";
|
|
lbCurrValue[i].TextHAlign = SmartX.SmartLabel.TextHorAlign.Right;
|
|
lbCurrValue[i].TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
|
|
lbCurrValue[i].Wordwrap = false;
|
|
}
|
|
|
|
lbNewValue = new SmartX.SmartLabel[SYS_PARAM_MAX];
|
|
for (int i = 0; i < SYS_PARAM_MAX; i++)
|
|
{
|
|
lbNewValue[i] = new SmartX.SmartLabel();
|
|
//lbNewValue[i].BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(192)))), ((int)(((byte)(255)))));
|
|
lbNewValue[i].BackPictureBox = null;
|
|
lbNewValue[i].BackPictureBox1 = null;
|
|
lbNewValue[i].BackPictureBox2 = null;
|
|
lbNewValue[i].BorderColor = System.Drawing.Color.Black;
|
|
lbNewValue[i].BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
lbNewValue[i].Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Bold);
|
|
lbNewValue[i].InitVisible = true;
|
|
lbNewValue[i].LineSpacing = 0F;
|
|
lbNewValue[i].Location = new System.Drawing.Point(456, 92 + (i * 37));
|
|
lbNewValue[i].Name = String.Format("ParamWarning{0}", i);
|
|
lbNewValue[i].Size = new System.Drawing.Size(159, 35);
|
|
lbNewValue[i].TabIndex = 70;
|
|
lbNewValue[i].Text = "0 ";
|
|
lbNewValue[i].TextHAlign = SmartX.SmartLabel.TextHorAlign.Right;
|
|
lbNewValue[i].TextVAlign = SmartX.SmartLabel.TextVerAlign.Middle;
|
|
lbNewValue[i].Wordwrap = false;
|
|
}
|
|
btnSet = new SmartX.SmartButton[9];
|
|
for (int i = 0; i < 9; i++)
|
|
{
|
|
btnSet[i] = new SmartX.SmartButton();
|
|
btnSet[i].BackPictureBox = null;
|
|
btnSet[i].BackPictureBox1 = null;
|
|
btnSet[i].BackPictureBox2 = null;
|
|
btnSet[i].ButtonColor = System.Drawing.Color.Gray;
|
|
btnSet[i].ButtonImageAutoSize = true;
|
|
btnSet[i].ColorKeySamplePosition = new System.Drawing.Point(0, 0);
|
|
btnSet[i].DisableImage = null;
|
|
btnSet[i].DownImage = btnSetA.DownImage;
|
|
btnSet[i].Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Bold);
|
|
btnSet[i].GroupID = 0;
|
|
btnSet[i].InitVisible = true;
|
|
btnSet[i].Location = new System.Drawing.Point(662, 92 + (i * 37));
|
|
btnSet[i].Mode = SmartX.SmartButton.BUTTONMODE.NORMAL;
|
|
btnSet[i].Name = "btnSetA";
|
|
btnSet[i].NestedClickEventPrevent = false;
|
|
btnSet[i].RepeatInterval = 1000;
|
|
btnSet[i].SafeInterval = 200;
|
|
btnSet[i].Size = new System.Drawing.Size(135, 35);
|
|
btnSet[i].SpecialFunction = SmartX.SmartButton.SPECIALFUNC.NONE;
|
|
btnSet[i].TabIndex = 1 + i;
|
|
btnSet[i].Text = "SET";
|
|
btnSet[i].TextColor = System.Drawing.Color.Black;
|
|
btnSet[i].TextDownColor = System.Drawing.Color.White;
|
|
btnSet[i].TextHAlign = SmartX.SmartButton.TextHorAlign.Middle;
|
|
btnSet[i].TextLocation = new System.Drawing.Point(0, 0);
|
|
btnSet[i].TextVAlign = SmartX.SmartButton.TextVerAlign.Middle;
|
|
btnSet[i].UpImage = btnSetA.UpImage;
|
|
btnSet[i].Click += new System.EventHandler(SysConfigSetCmd_Click);
|
|
}
|
|
}
|
|
|
|
private void ResetControl()
|
|
{
|
|
this.SuspendLayout();
|
|
this.Controls.Clear();
|
|
|
|
for (int i = 0; i < SYS_PARAM_MAX; i++)
|
|
{
|
|
this.Controls.Add(lbParamName[i]);
|
|
this.Controls.Add(lbCurrValue[i]);
|
|
//this.Controls.Add(lbNewValue[i]);
|
|
this.Controls.Add(btnSet[i]);
|
|
}
|
|
|
|
this.Controls.Add(this.lbHdSetting);
|
|
//this.Controls.Add(this.lnHdNewValue);
|
|
this.Controls.Add(this.lnHdCurrValue);
|
|
this.Controls.Add(this.lbHdParamName);
|
|
this.Controls.Add(this.btnMenu);
|
|
this.Controls.Add(this.smartForm1);
|
|
|
|
this.ResumeLayout(false);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region BUTTON EVENT
|
|
|
|
private void btnMenu_Click(object sender, EventArgs e)
|
|
{
|
|
((fmBMSMain)(Owner)).ChangeScreen(0, 0, ScreenID.SET_MENU_SCREEN_ID);
|
|
}
|
|
|
|
private void SysConfigSetCmd_Click(object sender, EventArgs e)
|
|
{
|
|
int i = ((SmartX.SmartButton)(sender)).TabIndex;
|
|
|
|
((fmBMSMain)(Owner)).ScreenSaverTimeReset();
|
|
((fmBMSMain)(Owner)).chfSystemSetCmd.SetID = i;
|
|
|
|
((fmBMSMain)(Owner)).ChangeScreen(0, 0, ScreenID.SYSTEM_SET_CMD_SCREEN);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region DIPLAY FUNCTIONS
|
|
|
|
private void tmrDisplay_Tick(object sender, EventArgs e)
|
|
{
|
|
DisplayParam(false);
|
|
}
|
|
|
|
private void DisplayParam(bool p)
|
|
{
|
|
int aParam, i;
|
|
DeviceDataSystem aBMSData;
|
|
|
|
aBMSData = ((fmBMSMain)(Owner)).GetBmsSystemData();
|
|
|
|
// Module Quantity Display
|
|
i = 0;
|
|
if (p || (disBMSData.ModuleQuantity != aBMSData.ModuleQuantity))
|
|
{
|
|
aParam = aBMSData.ModuleQuantity;
|
|
lbCurrValue[i].Text = String.Format("{0:#0} ", Convert.ToDouble(aParam) / 1);
|
|
disBMSData.ModuleQuantity = aBMSData.ModuleQuantity;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |