예제 #1
0
파일: FrmMain.cs 프로젝트: littleking/DJK
        private void CalculateData()
        {
            OpenFileDialog file1 = new OpenFileDialog();

            if (file1.ShowDialog() == DialogResult.OK)
            {
                FileInfo fileInfo = null;
                try
                {
                    fileInfo = new FileInfo(file1.FileName);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
                if (fileInfo != null && fileInfo.Exists)
                {
                    string filepath = fileInfo.FullName;
                    if (File.Exists(sourceFile))
                    {
                        File.Delete(sourceFile);
                    }
                    File.Copy(filepath, sourceFile);
                    splashScreenManager1.ShowWaitForm();
                    splashScreenManager1.SetWaitFormCaption("正在加载数据");
                    splashScreenManager1.SetWaitFormDescription(" 请等待。。。");
                    SaveFileToDB(true, sourceFile, "halleluja");
                    splashScreenManager1.SetWaitFormCaption("正在计算");
                    FrmCalculation frmCal = new FrmCalculation(mpList, ipList);
                    splashScreenManager1.CloseWaitForm();
                    frmCal.Show();
                }
            }
        }
예제 #2
0
파일: FrmMain.cs 프로젝트: littleking/DJK
        private void CalculateTxtData()
        {
            System.Data.DataTable dtInfo   = new System.Data.DataTable();
            System.Data.DataTable dtMatrix = new System.Data.DataTable();
            ipList = new List <InfoParser>();
            mpList = new List <MatrixParser>();
            if (File.Exists(infoFile) && File.Exists(matrixFile))
            {
                splashScreenManager1.ShowWaitForm();
                splashScreenManager1.SetWaitFormCaption("正在加载数据");
                splashScreenManager1.SetWaitFormDescription(" 请等待。。。");

                dtInfo   = OpenCSV(infoFile, 0, 0, 0, 0, true);
                dtMatrix = OpenCSV(matrixFile, 0, 0, 0, 0, true);
                foreach (DataRow dr in dtInfo.Rows)
                {
                    if (dr[0].ToString() == "0")
                    {
                        continue;
                    }
                    else
                    {
                        InfoParser ip = new InfoParser();
                        ip.No    = dr[0].ToString();
                        ip.Value = dr[1].ToString();
                        ip.Name  = dr[2].ToString();
                        ipList.Add(ip);
                    }
                }
                foreach (DataRow dr in dtMatrix.Rows)
                {
                    MatrixParser mp = new MatrixParser();
                    mp.No       = dr[0].ToString();
                    mp.Value    = dr[1].ToString();
                    mp.Name     = dr[2].ToString();
                    mp.OldValue = dr[3].ToString();
                    mpList.Add(mp);
                }

                splashScreenManager1.SetWaitFormCaption("正在计算");
                FrmCalculation frmCal = new FrmCalculation(mpList, ipList);
                splashScreenManager1.CloseWaitForm();
                frmCal.Show();
            }
            else
            {
                MessageBox.Show("CSV文件不存在");
            }
        }