ITC81DB_V8/ITC81DB/Controls/MainDisplay/ControlMainList.cs

174 lines
6.0 KiB
C#
Raw Permalink Normal View History

2023-07-11 01:56:01 +00:00
using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using ITC81DB.Forms;
using ITC81DB_ImageDll;
namespace ITC81DB.Controls
{
public partial class ControlMainList : UserControl
{
#region Field
private FormMainDisplay m_ParentForm;
#endregion
#region Constructor
public ControlMainList(FormMainDisplay parent)
{
InitializeComponent();
this.ParentForm = parent;
this.InitializeDesign();
this.DefaultSetting();
}
#endregion
#region Property
public FormMainDisplay ParentForm
{
get { return this.m_ParentForm; }
private set { this.m_ParentForm = value; }
}
#endregion
#region Method
public void InitializeDesign()
{
Class1 images = new Class1();
if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.English)
{
this.labelTitleTotalCount.Text = "Total";
this.labelStaticProductNumber.Text = "No";
this.labelStaticTime.Text = "Time";
this.labelStaticWeight.Text = "Weight";
this.labelStaticGrade.Text = "Grade";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Chinese)
{
this.labelTitleTotalCount.Text = "总共计数";
this.labelStaticProductNumber.Text = "编号";
this.labelStaticTime.Text = "时间";
this.labelStaticWeight.Text = "重量";
this.labelStaticGrade.Text = "等级";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Czech)
{
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Russian)
{
this.labelTitleTotalCount.Text = "Итоги";
this.labelStaticProductNumber.Text = "№";
this.labelStaticTime.Text = "Время";
this.labelStaticWeight.Text = "Вес";
this.labelStaticGrade.Text = "Сортировка";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.German)
{
this.labelTitleTotalCount.Text = "Insgesamt";
this.labelStaticProductNumber.Text = "Nr.";
this.labelStaticTime.Text = "Zeit";
this.labelStaticWeight.Text = "Gewicht";
this.labelStaticGrade.Text = "Ergebnis";
}
else if (this.ParentForm.ParentForm.SystemConfig1.Language == DataStore.LanguageID.Spanish)
{
this.labelTitleTotalCount.Text = "Total";
this.labelStaticProductNumber.Text = "No";
this.labelStaticTime.Text = "Tiempo";
this.labelStaticWeight.Text = "Peso";
this.labelStaticGrade.Text = "Calificación";
}
else
{
this.labelTitleTotalCount.Text = "전체수량";
this.labelStaticProductNumber.Text = "품번";
this.labelStaticTime.Text = "시간";
this.labelStaticWeight.Text = "중량";
this.labelStaticGrade.Text = "판정";
}
}
private void DefaultSetting()
{
}
public void UpdateEquipmentStatusDisplay(DataStore.EquipmentStatus status)
{
}
public void UpdateCurrentProductDisplay(DataStore.EquipmentStatus status, ProductItem pItem, WeightData wData)
{
//this.Clear();
}
public void UpdateStartWeightDisplay(DataStore.EquipmentStatus status, ProductItem pItem, WeightData wData)
{
string value = "", time = "", weight = "", no = "", total = "";
total = wData.TotalCount.ToString();
no = pItem.Number.ToString();
time = string.Format(@"{0:MM-dd HH:mm:ss}", DateTime.Now);
weight = Helper.DoubleToString(wData.Weight, this.ParentForm.ParentForm.SystemConfig1.DecimalPlaces);
if(wData.Weight == this.ParentForm.ParentForm.OverloadWeight)
value = string.Format("{0,15}{1,17}{2,28}{3,25}{4,30}", total, no, time, "O.L", wData.JudgmentStatus);
else
value = string.Format("{0,15}{1,17}{2,28}{3,25}{4,30}", total, no, time, weight, wData.JudgmentStatus);
if (this.smartListBox.Items.Count >= 100)
this.smartListBox.RemoveItem(0);
this.smartListBox.AddItem(value);
this.smartListBox.ScrollDown();
}
public void Clear()
{
this.smartListBox.ClearAll();
}
public void DisplayRefresh(SystemStatus status)
{
}
#endregion
#region Event Handler
private void buttonListUp_Click(object sender, EventArgs e)
{
if (this.smartListBox.ViewStartItemIndex / 9 > 0)
this.smartListBox.ScrollUp(161);
else
this.smartListBox.ScrollUp();
this.smartListBox.SelectItemIndex = -1;
}
private void buttonListDown_Click(object sender, EventArgs e)
{
if (this.smartListBox.ViewRemainCount / 9 > 0)
this.smartListBox.ScrollDown(161);
else
this.smartListBox.ScrollDown();
this.smartListBox.SelectItemIndex = -1;
}
private void buttonListRapidDown_Click(object sender, EventArgs e)
{
this.smartListBox.ScrollDown(this.smartListBox.ViewRemainCount / 9 * 161);
for (int i = 0; i < this.smartListBox.ViewRemainCount % 9; i++)
this.smartListBox.ScrollDown();
this.smartListBox.SelectItemIndex = -1;
}
#endregion
}
}