private void ShowLoadingLayerManualClose() { LoadingLayer ll = new LoadingLayer(this, .8D, true); ThreadPool.QueueUserWorkItem(o => { LoadingLayer layer = (LoadingLayer)o; for (int i = 0; i < 10; i++) { Thread.Sleep(500); int progress = (i + 1) * 10; layer.UpdateProgress(progress, $"当前进度 {progress}%"); } layer.Close(); }, ll); ll.Show(); }
private void btnLoadingLayer_Click(object sender, EventArgs e) { using (LoadingLayer ll = new LoadingLayer(this, .8D, true)) { ThreadPool.QueueUserWorkItem(o => { LoadingLayer layer = (LoadingLayer)o; for (int i = 0; i < 10; i++) { Thread.Sleep(500); int progress = (i + 1) * 10; layer.UpdateProgress(progress, $"当前进度 {progress}%"); } layer.Close(); }, ll); ll.Show(); } }