frmMultipleFileLogs.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.MultipleFileImport
  11. {
  12. public partial class frmMultipleFileLogs : LYFZ.ComponentLibrary.BaseContentsFormMain
  13. {
  14. public frmMultipleFileLogs()
  15. {
  16. InitializeComponent();
  17. this.lb_LogList.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.lb_LogList_MouseDoubleClick);
  18. }
  19. public void LoadFileList(string[] fileList)
  20. {
  21. foreach(string str in fileList)
  22. {
  23. lb_LogList.Items.Add(new ItemObj() {
  24. Name= System.IO.Path.GetFileName(str),
  25. AllPath= str
  26. } );
  27. }
  28. }
  29. private void lb_LogList_MouseDoubleClick(object sender, MouseEventArgs e)
  30. {
  31. if(lb_LogList.SelectedIndex !=-1)
  32. {
  33. ItemObj itemObj = lb_LogList.SelectedItem as ItemObj;
  34. frmMultipFileLogMessage frmLogMessage = new frmMultipFileLogMessage();
  35. frmLogMessage.tb_LogMessage.Text = File.ReadAllText(itemObj.AllPath);
  36. frmLogMessage.ShowDialog();
  37. }
  38. }
  39. }
  40. class ItemObj
  41. {
  42. public string AllPath { get; set; }
  43. public string Name { get; set; }
  44. public override string ToString()
  45. {
  46. return Name;
  47. }
  48. }
  49. }