示例#1
0
        public override void AttachListener(IController ctl)
        {
            MarkerListController controller = (MarkerListController)ctl;

            this.addDataMarkerToolStripMenuItem.Click       += controller.AddMarker;
            this.saveMarkerConfigToolStripMenuItem.Click    += controller.SaveMarker;
            this.loadMarkerConfigToolStripMenuItem.Click    += controller.LoadMarker;
            this.dataMarkerListDataGridView.CellDoubleClick += controller.CellDoubleClick;
            this.FormClosed += controller.FormClose;
        }
示例#2
0
        public void FixtureSetUp()
        {
            markerList = new MarkerList();
            MarkerListController ctl = new MarkerListController();

            ctl.initMarkerTable();

            List <EtyMarker> list = new List <EtyMarker>();

            ctl.SetMarkerTable(list);
            ctl.SetGrpName("Test_GrpName");

            markerList.AttachController(ctl);
            ctl.AttachCallBack(null, markerList);
        }
示例#3
0
        public void TestPopulateDataMarkerListDataGridView_GetMarkNameByRowIndex()
        {
            markerList.PopulateDataMarkerListDataGridView(1);
            markerList.GetMarkNameByRowIndex(10);
            MarkerListController ctl = (MarkerListController)(markerList.getController());

            EtyMarker marker1 = new EtyMarker();

            marker1.MarkerName = "a1";
            ctl.AddMarkerToList(marker1);

            markerList.PopulateDataMarkerListDataGridView(1);
            markerList.GetMarkNameByRowIndex(0);

            EtyMarker marker2 = new EtyMarker();

            marker2.MarkerName = "a2";
            ctl.AddMarkerToList(marker2);
            EtyMarker marker3 = new EtyMarker();

            marker3.MarkerName = "a3";
            ctl.AddMarkerToList(marker3);
            EtyMarker marker4 = new EtyMarker();

            marker4.MarkerName = "a4";
            ctl.AddMarkerToList(marker4);
            EtyMarker marker5 = new EtyMarker();

            marker5.MarkerName = "a5";
            ctl.AddMarkerToList(marker5);
            EtyMarker marker6 = new EtyMarker();

            marker6.MarkerName = "a6";
            ctl.AddMarkerToList(marker6);
            EtyMarker marker7 = new EtyMarker();

            marker7.MarkerName = "a7";
            ctl.AddMarkerToList(marker7);
            EtyMarker marker8 = new EtyMarker();

            marker8.MarkerName = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890";
            ctl.AddMarkerToList(marker8);

            markerList.PopulateDataMarkerListDataGridView(1);
        }
示例#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 TestfirstdataMarkerListDataGridView_Click_nextdataMarkerListDataGridView_Click()
        {
            Accessor markerListAccessor = ReflectionAccessor.Wrap(markerList);

            markerListAccessor.Call("firstdataMarkerListDataGridView_Click", null, null);

            markerList.PopulateDataMarkerListDataGridView(1);
            MarkerListController ctl     = (MarkerListController)(markerList.getController());
            EtyMarker            marker9 = new EtyMarker();

            marker9.MarkerName = "a9";
            ctl.AddMarkerToList(marker9);
            markerList.PopulateDataMarkerListDataGridView(2);

            markerListAccessor.Call("nextdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("pageNumdataMarkerListDataGridView_ValueChanged", null, null);
            markerListAccessor.Call("prevdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("lastdataMarkerListDataGridView_Click", null, null);
            markerListAccessor.Call("dataMarkerListDataGridView_Sorted", null, null);
        }
        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);
        }
示例#7
0
        public void TestAttachListener()
        {
            MarkerListController ctl = (MarkerListController)(markerList.getController());

            markerList.AttachListener(ctl);
        }
示例#8
0
        public void PopulateDataMarkerListDataGridView(int mode)
        {
            //  <summary>
            //  dataMarkerListDataGridView Data Population
            //  </summary>
            string Function_Name = "PopulateDataMarkerListDataGridView";

            dataMarkerListDataGridViewprogressBar.Visible = true;

            try
            {
                dataMarkerListDataGridViewprogressBar.Value = 0;

                totaldataMarkerListDataGridView.Text = "1";
                if (mode == 1)
                {
                    pageNumdataMarkerListDataGridView.Value = 1;
                }

                MarkerListController ctl = (MarkerListController)getController();

                int totalRecord = ctl.getMarkerTable().Rows.Count;  //m_dataMarkerListDataGridView.RowCount;  //todo check
                int upperRecord = 0;
                int lowerRecord = 0;
                if (totalRecord > 0)
                {
                    if (totalRecord % RECORDSIZE > 0)
                    {
                        totalRecord = totalRecord / RECORDSIZE;
                        totalRecord++;
                    }
                    else
                    {
                        totalRecord = totalRecord / RECORDSIZE;
                    }
                    totaldataMarkerListDataGridView.Text      = totalRecord.ToString();
                    pageNumdataMarkerListDataGridView.Maximum = totalRecord;
                }
                else
                {
                    pageNumdataMarkerListDataGridView.Maximum = 1;
                }

                upperRecord = (int)(RECORDSIZE * pageNumdataMarkerListDataGridView.Value);
                if (pageNumdataMarkerListDataGridView.Value > 1)
                {
                    lowerRecord = (int)(RECORDSIZE * (pageNumdataMarkerListDataGridView.Value - 1)) + 1;
                }
                else
                {
                    lowerRecord = (int)(RECORDSIZE * (pageNumdataMarkerListDataGridView.Value - 1));
                }

                string localSQL = "";
                if (dataMarkerListDataGridView.SortedColumn != null && dataMarkerListDataGridView.Rows.Count > 0)
                {
                    if (dataMarkerListDataGridView.SortedColumn.Name != null && dataMarkerListDataGridView.SortedColumn.Name.Trim() != "")
                    {
                        localSQL = dataMarkerListDataGridView.SortedColumn.Name;
                        if (dataMarkerListDataGridView.SortOrder.ToString().ToLower() != "ascending")
                        {
                            localSQL += " DESC ";
                        }
                        else
                        {
                            localSQL += " ASC ";
                        }
                    }
                    else
                    {
                        localSQL = " MARKER_NAME ASC ";
                    }
                }
                else
                {
                    localSQL = " MARKER_NAME ASC ";
                }



                DataRow[] markerRowArray = ctl.getMarkerTable().Select("", localSQL);

                DataGridViewRow dataGridRow = null;
                DataRow         dataRow     = null;


                if (upperRecord > markerRowArray.Length)
                {
                    upperRecord = markerRowArray.Length;
                }

                int    counter    = 0;
                string tempString = "";

                dataMarkerListDataGridView.Rows.Clear();
                if (lowerRecord > 0)
                {
                    lowerRecord--;
                }
                dataMarkerListDataGridViewprogressBar.Value = 0;
                for (int i = lowerRecord; i < upperRecord; i++)
                {
                    dataMarkerListDataGridView.Rows.Add();
                    dataMarkerListDataGridViewprogressBar.Value++;
                    dataGridRow = dataMarkerListDataGridView.Rows[counter];
                    dataRow     = markerRowArray[i];

                    tempString = "";
                    tempString = dataRow["MARKER_NAME"].ToString();
                    if (tempString.Length > 100)
                    {
                        dataGridRow.Cells[2].Value = tempString.Substring(0, 100) + "...";
                    }
                    else
                    {
                        dataGridRow.Cells[2].Value = tempString;
                    }

                    dataGridRow.Cells[3].Value = dataRow["MARKER_WIDTH"].ToString();

                    if (TrendViewerHelper.isNumeric(dataRow["MARKER_BCOLOR"].ToString(), System.Globalization.NumberStyles.Number))
                    {
                        dataGridRow.Cells[4].Value           = "";
                        dataGridRow.Cells[4].Style.BackColor = Color.FromArgb(Convert.ToInt32(dataRow["MARKER_BCOLOR"].ToString()));
                    }

                    if (TrendViewerHelper.isNumeric(dataRow["MARKER_FCOLOR"].ToString(), System.Globalization.NumberStyles.Number))
                    {
                        dataGridRow.Cells[5].Style.BackColor = Color.FromArgb(Convert.ToInt32(dataRow["MARKER_FCOLOR"].ToString()));
                    }

                    dataGridRow.Cells[6].Value = dataRow["MARKER_VALUE"].ToString();


                    if (TrendViewerHelper.ChangeStrToBool(dataRow["MARKER_ENABLED"].ToString()))
                    {
                        dataGridRow.Cells[7].Value = Properties.Resources.img_checkmark;
                    }
                    else
                    {
                        dataGridRow.Cells[7].Value = Properties.Resources.blank;
                    }

                    counter++;
                }
            }
            catch (Exception localException)
            {
                LogHelper.Error(CLASS_NAME, Function_Name, localException.ToString());
            }

            dataMarkerListDataGridViewprogressBar.Visible = false;
        }