123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Threading;
- using System.Windows.Forms;
- namespace UAS_MES_NEW.PublicForm
- {
- public partial class SetLoadingWindow : CustomControl.BaseForm.BaseForm
- {
- Thread LoadingThread;
- public SetLoadingWindow()
- {
- InitializeComponent();
- }
- public SetLoadingWindow(Thread LoadEvent,string Title)
- {
- InitializeComponent();
- LoadingThread = LoadEvent;
- Text = Title;
- }
- private void SetLoadingWindow_Load(object sender, EventArgs e)
- {
- //设置Loading的大小,启动传递过来的进程
- loadingCircle1.OuterCircleRadius = 20;
- loadingCircle1.InnerCircleRadius = 12;
- loadingCircle1.Active = true;
- LoadingThread.Start();
- //在本窗体新建一个进程用来判断传递的进程是否执行结束
- Thread t1 = new Thread(SetLoadFinish);
- t1.Start();
- }
- private void SetLoadFinish()
- {
- try
- {
- while (LoadingThread.IsAlive)
- {
- }
- Close();
- }
- catch (Exception)
- {
- return;
- }
- }
-
- //在进程结束之前不允许此窗体被关闭
- private void SetLoadingWindow_FormClosing(object sender, FormClosingEventArgs e)
- {
- if (LoadingThread.IsAlive) {
- e.Cancel=true;
- }
- }
- }
- }
|