private void MQCShowLine_FormClosed(object sender, FormClosedEventArgs e) { bgWorker.ProgressChanged -= BgWorker_ProgressChanged; bgWorker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); tmrCallBgWorker.Tick -= new EventHandler(tmrCallBgWorker_Tick); if (line != null) { line.Dispose(); line = null; } }
private void ProductionMain_FormClosed(object sender, FormClosedEventArgs e) { bgWorker.DoWork -= new DoWorkEventHandler(bg_DoWork); bgWorker.ProgressChanged -= BgWorker_ProgressChanged; bgWorker.RunWorkerCompleted -= new RunWorkerCompletedEventHandler(bg_RunWorkerCompleted); tmrCallBgWorker.Tick -= new EventHandler(tmrCallBgWorker_Tick); if (line != null) { line.Dispose(); line = null; } tmrCallBgWorker.Stop(); bgWorker.Dispose(); tmrCallBgWorker.Dispose(); }
private void LoadDataERPMQCToShow() { //Load data from m_ERPMQC LoadDataMQC dataMQC = new LoadDataMQC(); dept = "B01"; process = "MQC"; ListMQCshow = dataMQC.listMQCItemsOfDept(dateTimeFrom, dateTimeTo, dept, process); int topCount = CountColumn * CountRow; ListMQCTake = ListMQCshow.Take(topCount).ToList(); layoutMain.Controls.Clear(); if (ListMQCTake.Count <= topCount) { int countList = 0; for (int i = 0; i < CountRow; i++) { for (int j = 0; j < CountColumn; j++) { if (countList < ListMQCTake.Count) { // line.Dispose(); if (this.WindowState == FormWindowState.Normal) { line = new LineUI(ListMQCTake[countList], cb_Department.Text, 20); } else if (this.WindowState == FormWindowState.Maximized) { line = new LineUI(ListMQCTake[countList], cb_Department.Text, 25); } line.Name = ListMQCTake[countList].product; line.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); layoutMain.Controls.Add(line, j, i); countList++; } } } } lb_Clock.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); }
public void IntializeforTableLayout() { layoutMain.Controls.Clear(); layoutMain.ColumnCount = CountColumn; layoutMain.RowCount = CountRow; float Percerntwidth = (float)(100 / layoutMain.ColumnCount); float Percerntheight = (float)(100 / layoutMain.RowCount); layoutMain.ColumnStyles.Clear(); for (int i = 0; i < layoutMain.ColumnCount - 1; i++) { layoutMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, Percerntwidth)); } layoutMain.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100 - (Percerntwidth * (layoutMain.ColumnCount - 1)))); layoutMain.RowStyles.Clear(); for (int i = 0; i < layoutMain.RowCount - 1; i++) { layoutMain.RowStyles.Add(new RowStyle(SizeType.Percent, Percerntheight)); } layoutMain.RowStyles.Add(new RowStyle(SizeType.Percent, 100 - Percerntheight * (layoutMain.RowCount - 1))); for (int i = 0; i < layoutMain.ColumnCount; i++) { for (int j = 0; j < layoutMain.RowCount; j++) { // line.Dispose(); if (this.WindowState == FormWindowState.Normal) { line = new LineUI(MQCItem1, cb_Department.Text, 20); } else if (this.WindowState == FormWindowState.Maximized) { line = new LineUI(MQCItem1, cb_Department.Text, 25); } line.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); layoutMain.Controls.Add(line, i, j); } } isStartup = true; }
//private void ScaleFont(Label lab) //{ // SizeF extent = TextRenderer.MeasureText(lab.Text, lab.Font); // float hRatio = lab.Height / extent.Height; // float wRatio = lab.Width / extent.Width; // float ratio = (hRatio < wRatio) ? hRatio : wRatio; // float newSize = lab.Font.Size * ratio; // lab.Font = new Font(lab.Font.FontFamily, newSize, lab.Font.Style); //} private void LoadDataERPMQCToShow() { //Load data from m_ERPMQC LoadDataMQC dataMQC = new LoadDataMQC(); dept = "B01"; process = "MQC"; ListMQCshow = dataMQC.listMQCItemsOfDept(dateTimeFrom, dateTimeTo, dept, process); var listshowline = ListMQCshow .OrderBy(u => u.line) .GroupBy(u => u.line) .Select(grp => grp.ToList()) .ToList(); List <MQCItem1> ListShowbyLine = new List <MQCItem1>(); foreach (var LineData in listshowline) { MQCItem1 mQC = new MQCItem1(); DateTime maxDate = LineData.Select(d => d.DateRun).Max(); mQC = LineData.Where(d => d.DateRun == maxDate).ToList()[0]; ListShowbyLine.Add(mQC); } int topCount = CountColumn * CountRow; //ListMQCTake = ListMQCshow.Take(topCount).ToList(); layoutMain.Controls.Clear(); if (ListShowbyLine.Count <= topCount) { int countList = 0; for (int i = 0; i < CountRow; i++) { for (int j = 0; j < CountColumn; j++) { if (countList < ListShowbyLine.Count) { // line.Dispose(); if (this.WindowState == FormWindowState.Normal) { line = new LineUI(ListShowbyLine[countList], cb_Department.Text, 20); } else if (this.WindowState == FormWindowState.Maximized) { line = new LineUI(ListShowbyLine[countList], cb_Department.Text, 25); } line.Name = ListShowbyLine[countList].line; line.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); layoutMain.Controls.Add(line, j, i); countList++; } } } } lb_Clock.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); }
private void LoadDataERPMQCToShow() { //Load data from m_ERPMQC LoadDataMQC dataMQC = new LoadDataMQC(); dept = "B01"; process = "MQC"; ListMQCshow = dataMQC.listMQCItemsOfLine(dateTimeFrom, dateTimeTo, Line, process); var MQCCurrent = ListMQCshow.Where(d => d.DateRun == ListMQCshow.Select(a => a.DateRun).Max()).ToList(); int topCount = CountColumn * CountRow; //ListMQCTake = ListMQCshow.Take(topCount).ToList(); layoutMain.Controls.Clear(); if (ListMQCshow != null) { int countList = 0; for (int i = 0; i < CountRow; i++) { for (int j = 0; j < CountColumn; j++) { if (countList < ListMQCshow.Count) { if (ListMQCshow[countList].PO == MQCCurrent[0].PO) { if (this.WindowState == FormWindowState.Normal) { line = new LineUI(ListMQCshow[countList], cb_Department.Text, 20, "Now"); } else if (this.WindowState == FormWindowState.Maximized) { line = new LineUI(ListMQCshow[countList], cb_Department.Text, 25, "Now"); } } else { // line.Dispose(); if (this.WindowState == FormWindowState.Normal) { line = new LineUI(ListMQCshow[countList], cb_Department.Text, 20); } else if (this.WindowState == FormWindowState.Maximized) { line = new LineUI(ListMQCshow[countList], cb_Department.Text, 25); } } line.Name = ListMQCshow[countList].line; line.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); layoutMain.Controls.Add(line, j, i); countList++; } } } } lb_Clock.Text = DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"); }