MainForm.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Reflection;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using Waka.Lego.Commons;
  12. using Y.Utils.IOUtils.LogUtils;
  13. using Y.Utils.ReflectionUtils.ReflectionCoreUtils;
  14. namespace Waka.Lego.Views
  15. {
  16. public partial class MainForm : Form
  17. {
  18. string[] plugins = new string[] {
  19. @"D:\CoCo\GitHub\Fork\Fork.Net\Waka.Lego\bin\Debug\Bin\Plugins\Waka.Lego.Baidu\Waka.Lego.Baidu.dll" ,
  20. @"D:\CoCo\GitHub\Fork\Fork.Net\Waka.Lego\bin\Debug\Bin\Plugins\Waka.Lego.Icon\Waka.Lego.Icon.dll",
  21. @"D:\CoCo\GitHub\Fork\Fork.Net\Waka.Lego\bin\Debug\Bin\Plugins\Waka.Lego.Music\Waka.Lego.Music.dll"};
  22. public MainForm()
  23. {
  24. InitializeComponent();
  25. }
  26. private void MainForm_Load(object sender, EventArgs e)
  27. {
  28. foreach (var p in plugins)
  29. {
  30. Assembly ass = Assembly.LoadFile(p);
  31. dataGridView1.Rows.Add(string.Format("Name:{0}, Path:{1}", ass.FullName, p));
  32. }
  33. }
  34. private void dataGridView1_DoubleClick(object sender, EventArgs e)
  35. {
  36. if (dataGridView1.CurrentRow != null && dataGridView1.CurrentRow.Index < plugins.Count())
  37. {
  38. try
  39. {
  40. SimpleReflection sr = new SimpleReflection();
  41. Form form = sr.Do<Form>(plugins[dataGridView1.CurrentRow.Index], "LegoRun", "Run", null, null);
  42. form.Show();
  43. }
  44. catch { }
  45. }
  46. }
  47. }
  48. }