Пример #1
0
        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);
        }
Пример #2
0
        public void FixtureSetUp()
        {
            if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1)
            {
                DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR);
                SimpleDatabase.GetInstance().OpenConnection();
            }
            ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory());
            IView view = ViewManager.GetInstance().GetView(TrendViewConst.FormulaList, TestConst.TEST_VIEW_ID);

            formulaListController = (FormulaListController)(view.getController());
            formulaListController.initFormulaTable();

            FormulaListModel model = new FormulaListModel();

            formulaListController.SetFormulaTable(model.GetFormulaListByGrp(TestConst.FORMULA_GROUP_NAME));
            formulaListController.SetGrpName(TestConst.FORMULA_GROUP_NAME);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="paramList"> arg[0]: "view-0/view-edit-0/..", arg[1] datapoint, arg[2] marker,arg[3] history, arg[4] formula
        /// </param>
        public void DrawTrendView(ref Form frm, string paramList)
        {
            //get trending data by model
            //call to view for drawing
            string[]  arg         = paramList.Split(new char[] { ',' }, StringSplitOptions.None);
            int       screenWidth = ConfigureFileHelper.GetInstance().ScreenWidth;
            const int OFFSET      = 200;

            if (arg.Length > 0)
            {
                if (arg[0].Trim().ToLower() == "view-edit-0")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = 0 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-1")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-edit-2")
                {
                    this.accessRight  = "Y";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                else if (arg[0].Trim().ToLower() == "view-0")
                {
                    this.accessRight  = "N";
                    this.leftLocation = 0;
                }
                else if (arg[0].Trim().ToLower() == "view-1")
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth + OFFSET;
                }
                else
                {
                    this.accessRight  = "N";
                    this.leftLocation = screenWidth * 2 + OFFSET;
                }
                frm.StartPosition = FormStartPosition.Manual;
                frm.Location      = new Point(leftLocation, 0x9b);
            }
            if (arg.Length > 1)
            {
                if (arg[1].ToString().Trim() != "")
                {
                    DataPointListModel model = new DataPointListModel();
                    m_trendCache.m_dataPointList    = model.GetDPListByGrp(arg[1].Trim());
                    m_trendCache.m_datapointGrpName = arg[1].Trim();
                }
            }
            if (arg.Length > 2)
            {
                if (arg[2].ToString().Trim() != "")
                {
                    MarkerListModel model = new MarkerListModel();
                    m_trendCache.m_markerList    = model.GetMarkerListByGrp(arg[2].Trim());
                    m_trendCache.m_markerGrpName = arg[2].Trim();
                }
            }
            if (arg.Length > 3)
            {
                if (arg[3].ToString().Trim() != "")
                {
                    HistDataPointListModel model = new HistDataPointListModel();
                    m_trendCache.m_histDataPointList    = model.GetHistDListByGrp(arg[3].Trim());
                    m_trendCache.m_histDatapointGrpName = arg[3].Trim();
                }
            }
            if (arg.Length > 4)
            {
                if (arg[4].ToString().Trim() != "")
                {
                    FormulaListModel model = new FormulaListModel();
                    m_trendCache.m_formulaList    = model.GetFormulaListByGrp(arg[4].Trim());
                    m_trendCache.m_formulaGrpName = arg[4].Trim();
                }
            }
            object    sender = null;
            EventArgs e      = null;

            if (arg.Length > 1)
            {
                RealTimeExecuteCmd_Click(sender, e);
            }
        }
        public IView CreateView(string type, string id)
        {
            IView       view       = null;
            IController controller = null;
            IModel      model      = null;

            switch (type)
            {
            case  TrendViewConst.About:
                view          = new About();
                view.ViewType = TrendViewConst.About;
                break;

            case TrendViewConst.TrendView:
                view          = new TrendView();
                view.ViewType = TrendViewConst.TrendView;
                controller    = new TrendViewController();
                model         = new TrendViewModel();
                controller.Attach(model, view);
                break;

            // marker related:
            case TrendViewConst.MarkerList:
                view          = new MarkerList();
                view.ViewType = TrendViewConst.MarkerList;
                controller    = new MarkerListController();
                model         = new MarkerListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigMarker:
                view       = new MarkerGroup();
                controller = new MarkerGroupController();
                model      = new MarkerGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigMarker:
                view       = new MarkerGroup();
                controller = new MarkerGroupController();
                model      = new MarkerGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddMarkerData:
                view       = new MarkerData();
                controller = new MarkerDataController();
                model      = new MarkerDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditMarkerData:
                view       = new MarkerData();
                controller = new MarkerDataController();
                model      = new MarkerDataModel();
                controller.Attach(model, view);
                break;

            // formula related:
            case TrendViewConst.FormulaList:
                view          = new FormulaList();
                view.ViewType = TrendViewConst.FormulaList;
                controller    = new FormulaListController();
                model         = new FormulaListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigFormula:
                view       = new FormulaGroup();
                controller = new FormulaGroupController();
                model      = new FormulaGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigFormula:
                view       = new FormulaGroup();
                controller = new FormulaGroupController();
                model      = new FormulaGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddFormulaData:
                view       = new FormulaData();
                controller = new FormulaDataController();
                model      = new FormulaDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditFormulaData:
                view       = new FormulaData();
                controller = new FormulaDataController();
                model      = new FormulaDataModel();
                controller.Attach(model, view);
                break;

            // DP related:
            case TrendViewConst.DataPointList:
                view          = new DataPointList();
                view.ViewType = TrendViewConst.DataPointList;
                controller    = new DataPointListController();
                model         = new DataPointListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigDataPoint:
                view       = new DataPointGroup();
                controller = new DataPointGroupController();
                model      = new DataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigDataPoint:
                view       = new DataPointGroup();
                controller = new DataPointGroupController();
                model      = new DataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddDataPointData:
                view       = new DataPointData();
                controller = new DataPointDataController();
                model      = new DataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditDataPointData:
                view       = new DataPointData();
                controller = new DataPointDataController();
                model      = new DataPointDataModel();
                controller.Attach(model, view);
                break;

            //Hist DP related:
            case TrendViewConst.HistDataPointList:
                view          = new HistDataPointList();
                view.ViewType = TrendViewConst.HistDataPointList;
                controller    = new HistDataPointListController();
                model         = new HistDataPointListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigHistDataPoint:
                view       = new HistDataPointGroup();
                controller = new HistDataPointGroupController();
                model      = new HistDataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigHistDataPoint:
                view       = new HistDataPointGroup();
                controller = new HistDataPointGroupController();
                model      = new HistDataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddHistDataPointData:
                view       = new HistDataPointData();
                controller = new HistDataPointDataController();
                model      = new HistDataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditHistDataPointData:
                view       = new HistDataPointData();
                controller = new HistDataPointDataController();
                model      = new HistDataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.OPCDataSelector:
                view       = new OPCDataSelector();
                controller = new OPCDataSelectorController();
                model      = new OPCDataSelectorModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.ChangeTrendTitle:
                view       = new EditChartTitle();
                controller = new ChangeTrendTitleController();
                model      = null;
                controller.Attach(model, view);
                break;

            default:
                break;
            }
            view.ViewID = id;
            return(view);
        }
 public override void AttachCallBack(IModel model, IView view)
 {
     m_Model = (FormulaListModel)model;
     m_View  = (TrendViewer.View.FormulaList)view;
 }