UControl_Log.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace HOZProject
  11. {
  12. public partial class UControl_Log : UserControl
  13. {
  14. public UControl_Log()
  15. {
  16. InitializeComponent();
  17. }
  18. private void btnClose_Click(object sender, EventArgs e)
  19. {
  20. Form fParent = this.ParentForm;
  21. fParent.Close();
  22. }
  23. public void ShowProcessLogInfo(string[] strLog)
  24. {
  25. DataTable dt = new DataTable();
  26. dt.Columns.Add("Time");
  27. dt.Columns.Add("Name");
  28. dt.Columns.Add("State");
  29. foreach (string strItem in strLog)
  30. {
  31. string[] Nt = strItem.Split('_');
  32. DataRow dr = dt.NewRow();
  33. dr[0] = Nt[0];
  34. dr[1] = Nt[1];
  35. dr[2] = "1";
  36. dt.Rows.Add(dr);
  37. }
  38. dgvLog.DataSource = dt;
  39. lblLogCount.Text = dt.Rows.Count.ToString()+"条";
  40. }
  41. private void dgvLog_SelectionChanged(object sender, EventArgs e)
  42. {
  43. dgvLog.ClearSelection();
  44. }
  45. }
  46. }