Example #1
0
        /// <summary>
        /// 完了イベントハンドラー
        /// </summary>
        /// <param name="sender">イベント元</param>
        /// <param name="e">パラメーター</param>
        /// <author>Takanori Shibuya</author>
        private void CompleteEventHandler(object sender, CompleteEventArgs e)
        {
            if (e.IsAbort)
            {
                // 中断処理
                foreach (INotifyComplete it in this.list)
                {
                    it.Complete -= this.CompleteEventHandler;
                }
                this.list.Clear();
                this.OnComplete(true);
            }
            else
            {
                // 処理完了
                ((INotifyComplete)sender).Complete -= this.CompleteEventHandler;
                this.list.Remove((INotifyCompleteExecutor)sender);

                if (this.list.Count == 0)
                {
                    // 全処理が完了したことを通知
                    this.OnComplete();
                }
                else
                {
                    // 次の処理を実行
                    this.list[0].Execution();
                }
            }
        }
        /// <summary>
        /// 完了イベント発火
        /// </summary>
        /// <param name="isAbort">trueならアボート</param>
        /// <author>Takanori Shibuya</author>
        protected void OnComplete(bool isAbort = false)
        {
            CompleteEventArgs ea = new CompleteEventArgs();

            ea.IsAbort = isAbort;

            if (this.Complete != null)
            {
                this.Complete(this, ea);
            }
        }