public IView CreateView(string type, string id) { IView view = null; IController controller = null; IModel model = null; switch (type) { case TrainTimeTableConst.TrainTimeTableView: view = new TrainTimeTableView(); view.ViewType = TrainTimeTableConst.TrainTimeTableView; controller = new TimeTableViewController(); model = new TimeTableViewModel(); controller.Attach(model, view); break; case TrainTimeTableConst.TimeTableWindowView: view = new TimeTableWindow(); view.ViewType = TrainTimeTableConst.TimeTableWindowView; controller = new TimeTableWindowController(); model = new TimeTableWindowModel(); controller.Attach(model, view); break; default: break; } view.ViewID = id; return(view); }
/// <summary> /// Attach event listener to this UI. /// </summary> /// <param name="ctl">.</param> public override void AttachListener(IController ctrl) { TimeTableViewController controller = (TimeTableViewController)ctrl; this.StartButton.Click += controller.StartDrawTimeTable; this.saveToolStripMenuItem.Click += controller.CaptureScreenShoot; this.printToolStripMenuItem.Click += controller.PrintScreen; this.timeTableChartCtrl1.GetChartMain().MouseDoubleClick += controller.ChartClick; this.timeTableChartCtrl1.GetChartMain().MouseWheel += controller.ChartMouseWheel; this.startTimePicker.ValueChanged += controller.StartTimeChanged; this.timeTableChartCtrl1.GetChartMain().AxisViewChanged += controller.AxisViewChange; this.timeTableChartCtrl1.GetChartMain().MouseEnter += controller.ChartMouseEnter; }