MyProcessBar.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
//www.51aspx.com
namespace MyProcessBar
{
    public partial class MyProcessBar : UserControl
    {
        public delegate void TaskHandler(ref decimal percentage);
        private Thread _monitorThread = null;
        private Thread _workerThread = null;
        private decimal _percentage = 0;
        private MyProcessBarStatue _currentStatue = MyProcessBarStatue.UnStarted;
        private TaskHandler _task = null;
        public MyProcessBar()
        {
            InitializeComponent();
            this._monitorThread = new Thread(new ThreadStart(Monitor));//监听线程 只构造一次
            
        }
        /// <summary>
        /// 任务委托
        /// 多次对该属性赋值会造成不必要的浪费
        /// </summary>
        public TaskHandler Task
        {
            set
            {
                //任务线程 通过传入引用类型参数获得实时的进度变更 
                this._workerThread = new Thread(() => value(ref _percentage));
                this._task = value;
            }
        }

        /// <summary>
        /// 外部也可以实时获取当前任务进度
        /// </summary>
        public decimal Percentage
        {
            get
            {
                return this._percentage;
            }
        }
        /// <summary>
        /// 外部实时获取当前任务状态
        /// </summary>
        public MyProcessBarStatue CurrentStatue
        {
            get
            {
                return this._currentStatue;
            }
        }
后面还有 164 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。