public override void NotifyObserver(NotifyObject notifyObj)
        {
            //throw new Exception("The method or operation is not implemented.");
            //  notifyObj.Name = can be a view id
            //  notifyObj.Type==Notify data type which is defined in the DataNotificationCost.cs file

            if (notifyObj.Name != m_View.ViewID)
            {
                return;
            }

            //will only handle the notification when the ViewID is matching.

            if (notifyObj.Type == DataNotificaitonConst.SelectMarkGroupToLoad)
            {
                SetMarkerTable(m_Model.GetMarkerListByGrp((string)(notifyObj.Body)));
                m_grpName = (string)(notifyObj.Body);
                m_View.PopulateDataMarkerListDataGridView(1);
            }
            if (notifyObj.Type == DataNotificaitonConst.SaveMarkerToGroup)
            {
                m_grpName = (string)(notifyObj.Body);
                SaveMarkerListToGroup((string)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.AddMarker)
            {
                AddMarkerToList((EtyMarker)(notifyObj.Body));
            }
            if (notifyObj.Type == DataNotificaitonConst.ModifyMarker)
            {
                KeyValuePair <string, EtyMarker> pair = (KeyValuePair <string, EtyMarker>)(notifyObj.Body);
                ModifyMarker(pair.Key, pair.Value);
            }
        }
示例#2
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);
        }
示例#3
0
        public void TestAddMarker()
        {
            MarkerListModel model = new MarkerListModel();

            markerListController.SetMarkerTable(model.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME));
            markerListController.SetGrpName(TestConst.MARK_GROUP_NAME);
            markerListController.AddMarker(null, null);
        }
示例#4
0
        public void FixtureSetUp()
        {
            if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1)
            {
                DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR);
                SimpleDatabase.GetInstance().OpenConnection();
            }
            SimpleDatabase.GetInstance().OpenConnection();
            ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory());
            IView view = ViewManager.GetInstance().GetView(TrendViewConst.MarkerList, TestConst.TEST_VIEW_ID);

            markerListController = (MarkerListController)(view.getController());
            markerListController.initMarkerTable();
            MarkerListModel model = new MarkerListModel();

            markerListController.SetMarkerTable(model.GetMarkerListByGrp(TestConst.MARK_GROUP_NAME));
            markerListController.SetGrpName(TestConst.MARK_GROUP_NAME);
        }
示例#5
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);
        }
示例#6
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);
            }
        }