public override void AttachListener(IController ctl) { DataPointListController controller = (DataPointListController)ctl; this.addDataPointToolStripMenuItem.Click += controller.AddDataPoint; this.saveDataConfigToolStripMenuItem.Click += controller.SaveDataPoint; this.loadDataConfigToolStripMenuItem.Click += controller.LoadDataPoint; this.dataPointListDataGridView.CellDoubleClick += controller.CellDoubleClick; this.dataPointListDataGridView.Sorted += controller.DataPointListDataGridView_Sorted; this.pageNumDataPointListDataGridView.ValueChanged += controller.PageNumdataPointListDataGridView_ValueChanged; this.FormClosed += controller.FormClose;// new System.Windows.Forms.FormClosedEventHandler(this.DataPointList_FormClosed); }
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.DataPointList, TestConst.TEST_VIEW_ID); dataPointListController = (DataPointListController)(view.getController()); dataPointListController.InitDataPointTableColumn(); DataPointListModel model = new DataPointListModel(); dataPointListController.FillDataPointTable(model.GetDPListByGrp(TestConst.GROUP_NAME)); //will call setDataPointRowByEty dataPointListController.SetGrpName(TestConst.GROUP_NAME); }
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 void TestAttachListener() { IController ctl = new DataPointListController(); dataPointList.AttachListener(ctl); }