private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            WorkerArgument arg = e.UserState as WorkerArgument;

            if (!arg.HasError)
            {
                this.progressMsgLabel.Text = String.Format("{0}/{1}", arg.CurrentIndex, arg.OrderCount);
                this.ProgressValue         = e.ProgressPercentage;
            }
            else
            {
                this.progressMsgLabel.Text = arg.ErrorMessage;
            }
        }
        private bool NewMethod(BackgroundWorker worker, DoWorkEventArgs e)
        {
            WorkerArgument arg      = e.Argument as WorkerArgument;
            int            progress = 0;
            bool           success  = true;

            try
            {
                Results = new List <xmlDataSources>();

                List <string> Alist = GetBy_CategoryReportFileName(filepath);
                arg.OrderCount = Alist.Count;
                for (int i = 0; i < Alist.Count; i++)
                {
                    filename = Alist[i];

                    progress = Convert.ToInt16(((i) * 1.0 / Alist.Count) * 100);

                    arg.CurrentIndex = i;

                    LoadSalesData(filepath + "\\" + Alist[i]);

                    backgroundWorker1.ReportProgress(progress, arg);
                }
                //写入数据库
                clsAllnew BusinessHelp = new clsAllnew();

                BusinessHelp.SPInputclaimreport_Server(Results);
                backgroundWorker1.ReportProgress(100, arg);
                e.Result = string.Format("{0} 条正常导入成功", Results.Count);
            }
            catch (Exception ex)
            {
                if (!e.Cancel)
                {
                    //arg.HasError = true;
                    //arg.ErrorMessage = exception.Message;
                    e.Result = ex.Message + "或所导入信息超出要求长度";
                }
                success = false;
            }

            return(success);
        }