public void FixtureSetUp() { ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.TrendView, TestConst.TEST_VIEW_ID); trendViewController = (TrendViewController)view.getController(); if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1) { DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR); SimpleDatabase.GetInstance().OpenConnection(); } }
static void Main(string[] args) { string Function_Name = "Main"; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Add the event handler for handling UI thread exceptions to the event. Application.ThreadException += new ThreadExceptionEventHandler(Program.UIThreadExceptionHandler); try { ConfigureFileHelper.GetInstance().init(); //LanguageTypeHelper.GetInstance().SetLanaguageType(LanguageType.English); LanguageType type = LanguageTypeHelper.GetInstance().GetLanTypeByLanStr(ConfigureFileHelper.GetInstance().LanguageStr); LanguageTypeHelper.GetInstance().SetLanaguageType(type); DAOHelper.SetEncodingChange(ConfigureFileHelper.GetInstance().EncodingChange); LanguageHelper.InitAllStrings(); string eventName = CreateWin32EventAndSetLogFile(); ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory()); IView view = ViewManager.GetInstance().GetView(TrendViewConst.TrendView); //viewID is "" Form frm = (Form)view; if (args.Length > 0) { TrendViewController trendController = (TrendViewController)view.getController(); trendController.DrawTrendView(ref frm, args[0]); } Application.Run(frm); //event will be closed automatically. LogHelper.Info(CLASS_NAME, Function_Name, "Closed Event:" + eventName); } catch (Exception localExecption) { LogHelper.Error("TrendViewer.Program", Function_Name, localExecption.ToString()); } }
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() { TrendViewController ctl = new TrendViewController(); trendView.AttachListener(ctl); }