public void TestStartRealTimeOrMixedModeCharting01() { DataPointListModel dataPointListModel = new DataPointListModel(); List <EtyDataPoint> dpList = dataPointListModel.GetDPListByGrp(TestConst.GROUP_NAME); TrendViewModel trendViewModel = new TrendViewModel(); DateTime fromTime = new DateTime(2013, 1, 10); DateTime toTime = new DateTime(2013, 1, 12); EtyHistDataPoint histDP = new EtyHistDataPoint(); histDP.DPName = TestConst.HIST_DP_NAME; histDP.DPServer = TestConst.SERVER; histDP.DPStartDateTime = fromTime; histDP.DPEndDateTime = toTime; histDP.DPEnabled = true; histDP.DPHost = TestConst.HOST; histDP.DPType = LineType.Line; List <EtyDataLogDPLogTrend> logList = trendViewModel.GetHistDPLogList(histDP, fromTime, toTime); Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); MarkerListModel markerListModel = new MarkerListModel(); List <EtyMarker> markerList = markerListModel.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME); FormulaListModel formulaListModel = new FormulaListModel(); List <EtyFormula> formulaList = formulaListModel.GetFormulaListByGrp(TestConst.FORMULA_GROUP_NAME); trendView.StartRealTimeOrMixedModeCharting(dpList, formulaList, markerList, histDPLogMap); }
//when usedInMixedMode is false, will ignore startTime and endTime public Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > GetHistDPLogMap(DateTime startTime, DateTime endTime) { Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); EtyHistDataPoint dp = null; List <EtyDataLogDPLogTrend> dpLogList = null; foreach (EtyHistDataPoint histDP in m_trendCache.m_histDataPointList) { if (histDP.DPEnabled == false) { continue; } dpLogList = m_Model.GetHistDPLogList(histDP, startTime, endTime); histDPLogMap.Add(histDP, dpLogList); } return(histDPLogMap); }
public void TestUpdateChartForRealTimeOrMixedMode03() { //same as TestUpdateChartForRealTimeOrMixedMode01,but Eval(tempString) throw exception DateTime fromTime = new DateTime(2013, 1, 10); DateTime toTime = new DateTime(2013, 1, 12); EtyHistDataPoint histDP = new EtyHistDataPoint(); histDP.DPName = TestConst.HIST_DP_NAME; histDP.DPServer = TestConst.SERVER; histDP.DPStartDateTime = fromTime; histDP.DPEndDateTime = toTime; histDP.DPEnabled = true; histDP.DPHost = TestConst.HOST; histDP.DPType = LineType.Line; TrendViewModel trendViewModel = new TrendViewModel(); List <EtyDataLogDPLogTrend> logList = trendViewModel.GetHistDPLogList(histDP, fromTime, toTime); Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); //stub: //OPCServerProxy.GetInstance().IsOPCServerConnected() == true //make sure series has contents: List <EtyDataPoint> dpList = new List <EtyDataPoint>(); EtyDataPoint etyDP = new EtyDataPoint(); etyDP.DPColor = "-32704"; etyDP.DPName = TestConst.DP_NAME; etyDP.DPEnabled = true; etyDP.DPServer = "TransActiveDataSource"; etyDP.DPType = LineType.Line; etyDP.DPVisible = true; etyDP.DPHost = "127.0.0.1"; dpList.Add(etyDP); List <EtyFormula> formulaList = new List <EtyFormula>(); EtyFormula formula = new EtyFormula(); formula.DPColor = "-32704"; formula.DPEnabled = true; formula.DPLblName = "formulaLblName"; formula.DPType = LineType.Line; formulaList.Add(formula); trendView.InitializeChartForRealTime(dpList, formulaList); // (mixedModeCb.Checked && m_startDateRealTime.Date != DateTime.Now.Date) CheckBox cb = (CheckBox)viewAccessor.GetField("mixedModeCb"); cb.Checked = true; viewAccessor.SetField("mixedModeCb", cb); DateTime dt = new DateTime(2011, 1, 1); viewAccessor.SetField("m_startDateRealTime", dt); trendView.UpdateChartForRealTimeOrMixedMode(histDPLogMap); }
public void TestStartRealTimeOrMixedModeCharting02() { //stub:IsOPCServerConnected = true DataPointListModel dataPointListModel = new DataPointListModel(); List <EtyDataPoint> dpList = dataPointListModel.GetDPListByGrp(TestConst.GROUP_NAME); TrendViewModel trendViewModel = new TrendViewModel(); DateTime fromTime = new DateTime(2013, 1, 10); DateTime toTime = new DateTime(2013, 1, 12); EtyHistDataPoint histDP = new EtyHistDataPoint(); histDP.DPName = TestConst.HIST_DP_NAME; histDP.DPServer = TestConst.SERVER; histDP.DPStartDateTime = fromTime; histDP.DPEndDateTime = toTime; histDP.DPEnabled = true; histDP.DPHost = TestConst.HOST; histDP.DPType = LineType.Line; List <EtyDataLogDPLogTrend> logList = trendViewModel.GetHistDPLogList(histDP, fromTime, toTime); Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); MarkerListModel markerListModel = new MarkerListModel(); List <EtyMarker> markerList = markerListModel.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME); FormulaListModel formulaListModel = new FormulaListModel(); List <EtyFormula> formulaList = formulaListModel.GetFormulaListByGrp(TestConst.FORMULA_GROUP_NAME); System.Windows.Forms.CheckBox cb = (System.Windows.Forms.CheckBox)viewAccessor.GetField("mixedModeCb"); cb.Checked = false; viewAccessor.SetField("mixedModeCb", cb); //stub: OPCServerProxy.GetInstance().IsOPCServerConnected() == true: trendView.StartRealTimeOrMixedModeCharting(dpList, formulaList, markerList, histDPLogMap); //mixedModeCb.Checked==true: cb.Checked = true; viewAccessor.SetField("mixedModeCb", cb); trendView.StartRealTimeOrMixedModeCharting(dpList, formulaList, markerList, histDPLogMap); }
public void TestDrawHistoryChart() { DataPointListModel dataPointListModel = new DataPointListModel(); List <EtyDataPoint> dpList = dataPointListModel.GetDPListByGrp(TestConst.GROUP_NAME); TrendViewModel trendViewModel = new TrendViewModel(); DateTime fromTime = new DateTime(2013, 1, 10); DateTime toTime = new DateTime(2013, 1, 12); EtyHistDataPoint histDP = new EtyHistDataPoint(); histDP.DPName = TestConst.HIST_DP_NAME; histDP.DPServer = TestConst.SERVER; histDP.DPStartDateTime = fromTime; histDP.DPEndDateTime = toTime; histDP.DPEnabled = true; histDP.DPHost = TestConst.HOST; histDP.DPType = LineType.Line; histDP.DPColor = "-32704"; List <EtyDataLogDPLogTrend> logList = trendViewModel.GetHistDPLogList(histDP, fromTime, toTime); Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); viewAccessor.Call("DrawHistoryChart", DrawHistoryMode.Mixed, histDPLogMap); logList = new List <EtyDataLogDPLogTrend>(); EtyDataLogDPLogTrend log = new EtyDataLogDPLogTrend(); logList.Add(log); histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); viewAccessor.Call("DrawHistoryChart", DrawHistoryMode.Mixed, histDPLogMap); viewAccessor.Call("DrawHistoryChart", DrawHistoryMode.NotMixed, histDPLogMap); }
public void TestStartRealTimeOrMixedModeCharting04() { //stub:IsOPCServerConnected = false ////RemoveAllOPCItem throw Exception DataPointListModel dataPointListModel = new DataPointListModel(); List <EtyDataPoint> dpList = dataPointListModel.GetDPListByGrp(TestConst.GROUP_NAME); TrendViewModel trendViewModel = new TrendViewModel(); DateTime fromTime = new DateTime(2013, 1, 10); DateTime toTime = new DateTime(2013, 1, 12); EtyHistDataPoint histDP = new EtyHistDataPoint(); histDP.DPName = TestConst.HIST_DP_NAME; histDP.DPServer = TestConst.SERVER; histDP.DPStartDateTime = fromTime; histDP.DPEndDateTime = toTime; histDP.DPEnabled = true; histDP.DPHost = TestConst.HOST; histDP.DPType = LineType.Line; List <EtyDataLogDPLogTrend> logList = trendViewModel.GetHistDPLogList(histDP, fromTime, toTime); Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> > histDPLogMap = new Dictionary <EtyHistDataPoint, List <EtyDataLogDPLogTrend> >(); histDPLogMap.Add(histDP, logList); MarkerListModel markerListModel = new MarkerListModel(); List <EtyMarker> markerList = markerListModel.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME); FormulaListModel formulaListModel = new FormulaListModel(); List <EtyFormula> formulaList = formulaListModel.GetFormulaListByGrp(TestConst.FORMULA_GROUP_NAME); //stub: OPCServerProxy.GetInstance().IsOPCServerConnected()==true //OPC server connected // OPCServerProxy.GetInstance().RemoveAllOPCItem() throw System.Exception trendView.StartRealTimeOrMixedModeCharting(dpList, formulaList, markerList, histDPLogMap); }