Exemple #1
0
 //参考值选择改变事件,刷新图表
 private void stand_ItemSelectionChangedEvent(Model.TB_StandardInfo selectedItem)
 {
     if (stand.SelectedItem != null)
     {
         standTestInfoModelList.Clear();
         standTestInfoModelList = Caches.Util.AthTestInfoModelUtil.AthTestUtil(refeBLL.GetStandTestInfoModelList(stand.SelectedItem.ID));
         RefrenshChart();
     }
 }
Exemple #2
0
        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            List <Model.TB_StandardInfo> checkedStandList = GetCheckedStand();

            if (checkedStandList.Count == 0)
            {
                DSJL.Tools.MessageBoxTool.ShowConfirmMsgBox("请选择要导出的测试参考值!");
                return;
            }
            if (DSJL.Tools.ShowFileDialogTool.ShowSaveFileDialog(out exportPath, "", "dsf", "等速肌力参考值导出") == false)
            {
                return;
            }
            exportPath = exportPath.Substring(0, exportPath.LastIndexOf("\\") + 1);
            Console.WriteLine("export path is:{0}", exportPath);

            ProgressWindow window = new ProgressWindow();

            window.WindowTilte   = "导出参考值进度";
            window.MaxValue      = checkedStandList.Count;
            window.MinValue      = 0;
            window.CancleMessage = "确定取消导出吗?";
            window.onCancling   += Window_onCancling;
            window.Owner         = this;

            Task task = new Task(() => {
                int progress = 0;
                foreach (var item in checkedStandList)
                {
                    if (isCancleExport)
                    {
                        break;
                    }
                    //1、查询测试信息
                    List <Model.TestInfoModel> testInfoModelList = Caches.Util.AthTestInfoModelUtil.AthTestUtil(refeBLL.GetStandTestInfoModelList(item.ID));
                    if (testInfoModelList.Count == 0)
                    {
                        continue;
                    }
                    Model.TestInfoModel avgTestInfoModel = GetAvgTestInfoModel(testInfoModelList);
                    string testInfoModelJson             = Newtonsoft.Json.JsonConvert.SerializeObject(avgTestInfoModel);
                    // Console.WriteLine(testInfoModelJson);
                    //2、计算平均值
                    List <List <XElement> > paramList = DSJL.Export.GenerateCompareResportXml.ComputeAvg(testInfoModelList);
                    string paramJson = Newtonsoft.Json.JsonConvert.SerializeObject(paramList);
                    // Console.WriteLine(paramJson);
                    Dictionary <DataPointsType, List <List <double> > > dataPointsDict = StandardChartCache.GetStandardDataPoints(item, testInfoModelList);
                    List <List <double> > oddavgsd  = dataPointsDict[DataPointsType.ODDAvgSD];
                    List <List <double> > evenavgsd = dataPointsDict[DataPointsType.EVENAVGSD];
                    string oddavgsdjson             = Newtonsoft.Json.JsonConvert.SerializeObject(oddavgsd);
                    string evenavgsdjson            = Newtonsoft.Json.JsonConvert.SerializeObject(evenavgsd);
                    // Console.WriteLine(oddavgsdjson);
                    // Console.WriteLine(evenavgsdjson);
                    //3、写入文件
                    Model.TB_StandardInfo parentStandModel  = standList.Find(x => x.ID == item.Stand_ParentID);
                    Model.ExportStandModel exportStandModel = new Model.ExportStandModel();
                    exportStandModel.ParentName             = parentStandModel.Stand_Name;
                    exportStandModel.StandName = item.Stand_Name;
                    exportStandModel.TestModel = avgTestInfoModel;
                    exportStandModel.ParamList = paramList;
                    exportStandModel.OddAvgSD  = oddavgsd;
                    exportStandModel.EvenAvgSD = evenavgsd;
                    string standJson           = Newtonsoft.Json.JsonConvert.SerializeObject(exportStandModel);
                    standJson       = DSJL.Tools.DES.Encrypt(standJson, "cissdsjl");
                    string filename = string.Format("{0}{1}.dsf", exportPath, item.Stand_Name);
                    StreamWriter sw = new StreamWriter(filename);
                    sw.Write(standJson);
                    sw.Close();
                    progress++;
                    Dispatcher.BeginInvoke(new Action(() => {
                        window.CurrentValue = progress;
                    }));
                }
                DSJL.Tools.MessageBoxTool.ShowConfirmMsgBox("导出完成!");
                Dispatcher.BeginInvoke(new Action(() =>
                {
                    window.Close();
                    this.Close();
                }));
            });

            task.Start();
            window.ShowDialog();
        }
Exemple #3
0
        private void ReferenshList()
        {
            testInfoModelList = new List <Model.TestInfoModel>();
            if (standManager.SelectedItem != null)
            {
                if (standManager.SelectedItem.Tag == -1)
                {
                    Model.TestInfoModel testInfoModel = Stand.StandConfig.GetTestInfoModel(standManager.SelectedItem.StandFileName);
                    if (testInfoModel != null)
                    {
                        testInfoModelList.Add(testInfoModel);
                    }
                }
                else
                {
                    if (standManager.SelectedItem.Stand_Level == 2)
                    {
                        testInfoModelList = Caches.Util.AthTestInfoModelUtil.AthTestUtil(refeBLL.GetStandTestInfoModelList(standManager.SelectedItem.ID));
                    }
                }
            }
            dgTestInfo.ItemsSource = testInfoModelList;

            pageAvgCurve.ModelList           = testInfoModelList;
            pageAvgCurve.CurrentStandardInfo = standManager.SelectedItem;
            pageAvgCurve.UpdateChart();
        }