public void Add(ProgressState state) { lock (this._states) { this._states.Add(state); } }
public void Remove(ProgressState state) { lock (this._states) { int index = this._states.IndexOf(state); if (index > -1) { for (int i = this._states.Count - 1; i >= index; i--) { this._states.RemoveAt(i); } } } }
/// <summary> /// 初始化实例 /// </summary> /// <param name="handle">父控件句柄</param> /// <param name="canCancel">是否可以取消,默认否(设置取消未注册事件,则直接关闭窗体)</param> /// <param name="caption">标题</param> /// <param name="delay">延迟显示时间(ms)</param> /// <param name="max">最大值</param> public Progress(IntPtr handle, bool canCancel = false, string caption = TConfig.Loading, int delay = 0, int max = 0) { this._state = new ProgressState(handle, caption, canCancel, delay, max); this._state.CancelEvent += State_CancelEvent; states.Add(this._state); }