コード例 #1
0
        public ProgressAsyncHelper(AsyncHelper.DoWork doWork, AsyncHelper.WorkDone workDone, System.Windows.Forms.Form owner, string progressCaption)
        {
            m_progressForm = new Feng.Windows.Forms.ProgressForm();

            m_asyncHelper = AsyncHelper.Start(doWork, new Feng.Async.AsyncHelper.WorkDone(delegate(object result)
            {
                this.m_progressForm.Stop();
                this.m_progressForm.Close();
                workDone(result);
            }));

            m_progressForm.ProgressStopped += new EventHandler((sender, e) =>
            {
                m_asyncHelper.AbortWorker();
            });

            m_progressForm.Start(owner, progressCaption);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="doWork"></param>
        /// <param name="workDone"></param>
        public static AsyncHelper Start(AsyncHelper.DoWork doWork, AsyncHelper.WorkDone workDone, System.Windows.Forms.Form owner, string progressCaption)
        {
            var i = new ProgressAsyncHelper(doWork, workDone, owner, progressCaption);

            return(i.m_asyncHelper);
        }