loading.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using loadingForm;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace prBrowser.Weblogic
  12. {
  13. public partial class loading : Form
  14. {
  15. public loading()
  16. {
  17. InitializeComponent();
  18. }
  19. private void loading_Load(object sender, EventArgs e)
  20. {
  21. //this.BackColor = Color.Transparent;
  22. this.WindowState = FormWindowState.Maximized;
  23. this.Opacity = 0.6;
  24. }
  25. /// <summary>
  26. /// 关闭命令
  27. /// </summary>
  28. public void closeOrder()
  29. {
  30. if (this.InvokeRequired)
  31. {
  32. //这里利用委托进行窗体的操作,避免跨线程调用时抛异常,后面给出具体定义
  33. CONSTANTDEFINE.SetUISomeInfo UIinfo = new CONSTANTDEFINE.SetUISomeInfo(new Action(() =>
  34. {
  35. while (!this.IsHandleCreated)
  36. {
  37. ;
  38. }
  39. if (this.IsDisposed)
  40. return;
  41. if (!this.IsDisposed)
  42. {
  43. this.Dispose();
  44. }
  45. }));
  46. this.Invoke(UIinfo);
  47. }
  48. else
  49. {
  50. if (this.IsDisposed)
  51. return;
  52. if (!this.IsDisposed)
  53. {
  54. this.Dispose();
  55. }
  56. }
  57. }
  58. private void loading_FormClosing(object sender, FormClosingEventArgs e)
  59. {
  60. if (!this.IsDisposed)
  61. {
  62. this.Dispose(true);
  63. }
  64. }
  65. private void button1_Click(object sender, EventArgs e)
  66. {
  67. LoadingHelper.CloseForm();//关闭
  68. }
  69. }
  70. class CONSTANTDEFINE
  71. {
  72. public delegate void SetUISomeInfo();
  73. }
  74. }