Esempio n. 1
0
        /// <summary>
        /// 获取表格DVG数据,通过读取原始dat文件
        /// </summary>
        /// <param name="_data"></param>
        /// <returns></returns>
        public bool GetDGVData(Data _data)
        {
            try
            {
                watch1.Start();
                List <double[]> dt = DatHelper.ReadDat(_data.Name);
                watch1.Stop();
                //_data.DGVDataSource = dt;
                if (dt == null || dt.Count == 0)
                {
                    return(false);
                }
                watch2.Start();

                if (GEOHelper.normalizationsToFile(dt, _data.Name) == null)
                {
                    return(false);
                }
                watch2.Stop();

                Console.WriteLine("DatHelper.ReadDat方法运行时长:" + watch1.Elapsed.TotalMilliseconds);
                Console.WriteLine("调用geo方法运行时长:" + watch2.Elapsed.TotalMilliseconds);
                watch1.Reset();
                watch2.Reset();

                return(true);
            }
            catch (Exception ex)
            {
                Log4netHelper.Error(ex);
                return(false);
            }
        }
Esempio n. 2
0
        //绘图
        private void PaintButton(object sender, EventArgs e)
        {
            //Task.Run(new Action(async () => { await RePaintDGV(); }));
            if (_Data.HZCount < 10)
            {
                _DataForm.ShowToast("提示", "测量数据不足10条不能绘图", 1);
                return;
            }

            pointNum = _DataRepository.getPointCount(_DataForm.InfoName).Result;
            if (SQLiteHelper.IsRePaint(_DataForm.InfoName))
            {
                #region 查询当前蓝牙的型号   &&  档位
                string    fet = "";
                string    sql = "select fet from info where name = '" + _DataForm.InfoName + "'";
                DataTable dt1 = SQLiteHelper.ExecuteDataTable(sql, null);
                if (dt1.Rows.Count != 0)
                {
                    fet = dt1.Rows[0].ItemArray[0].ToString();
                }

                string    sql1 = "select gears from info where name = '" + _DataForm.InfoName + "'";
                DataTable dt   = SQLiteHelper.ExecuteDataTable(sql1, null);
                if (dt.Rows.Count == 0)
                {
                    return;
                }

                string gears = dt.Rows[0].ItemArray[0].ToString();
                if (gears.Contains("wt"))
                {
                    gears = gears.Split(new char[] { 'w', 't', 'a' })[2];
                }
                else if (gears.Contains("g"))
                {
                    gears = gears.Split(new char[] { 'g', 'p' })[1];
                }
                #endregion
                //_DataForm.ShowToast("提示", "正在成图中,请稍后。。。", 2);

                #region 新增progressbar进度条显示
                //_DataForm.Visable();
                //显示绘图过程进度条
                ThreadPool.QueueUserWorkItem((obj) =>
                {
                    for (int i = 0; i < 100; i++)
                    {
                        Thread.Sleep(50);
                        _DataForm.PaintProgressBar(i);
                    }
                });
                #endregion

                ThreadPool.QueueUserWorkItem((obj) =>
                {
                    if (!GEOHelper.Surfer(_Data.Name, pointNum, fet, gears))
                    {
                        _DataForm.ShowToast("提示", "成图失败", 2);
                        return;
                    }
                });
                //修改是否重新成图的状态
                //isRePaintPic = true;
                _DataForm.SetPaintButtonText("查看");
                SQLiteHelper.UpdateRePaint(_DataForm.InfoName, "0");
                //_DataForm.ShowToast("提示", "成图成功!", 1);
                return;
            }

            _DataForm.SetPaintButtonText("查看");
            PictureForm _pictureForm = new PictureForm();
            _pictureForm.PictureName = _Data.Name;
            //_pictureForm.InfoSite = _DataForm.Site;
            _pictureForm.Show();
        }