TestPackForm.cs 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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.Text;
  8. using System.Windows.Forms;
  9. using Y.Utils.DelegateUtils;
  10. using Y.Utils.IOUtils.FileUtils;
  11. namespace Y.Test.Views
  12. {
  13. public partial class TestPackForm : Form
  14. {
  15. public TestPackForm()
  16. {
  17. InitializeComponent();
  18. }
  19. private void BTPack_Click(object sender, EventArgs e)
  20. {
  21. FilePackageTool.Pack(TBFrom.Text, TBTo.Text, UIProgress);
  22. }
  23. private void BTUnpack_Click(object sender, EventArgs e)
  24. {
  25. FilePackageTool.Unpack(TBFrom.Text, TBTo.Text, UIProgress);
  26. }
  27. private void UIProgress(object sender, ProgressEventArgs e)
  28. {
  29. BeginInvoke(new Action(() =>
  30. {
  31. progressBar1.Value = (int)(e.Current * 100 / e.Total);
  32. label1.Text = string.Format("{0} / {1}", e.Current, e.Total);
  33. }));
  34. }
  35. }
  36. }