コード例 #1
0
            /// <summary>
            /// 開始進行排名。
            /// </summary>
            public void Execute()
            {
                _adapters.AddAdapter("Student", new StudentAdapter(_students, RatingParams));

                //依參數(RatingParams)建立相對應的 Adapter。
                CreateRequiredAdapter();

                //設定每一個 Adapter 的進度回報介面。
                _adapters.ForEach(new Action <DataAdapter>(SetMainProgress));

                //呼叫每一個 Adapter 的 Fill 動作。
                _adapters.ForEach(new Action <DataAdapter>(FillData));

                int t1 = Environment.TickCount;

                //加一種排名範圍就加一種 Scope。
                CreateScopes();

                //加一種成績就加一種 Target。
                CrateTargets();

                Scopes.ForEach(RankAll);

                //呼叫每一個 Adapter 的 Update 動作。
                _adapters.ForEach(new Action <DataAdapter>(UpdateRatingData));

                _work_args.Cancel = _progress.Cancellation;

                if (_progress.Cancellation)
                {
                    _progress.ReportMessage("排名動作已取消。");
                }
                else
                {
                    _progress.ReportMessage("排名完成。");
                }
            }