TabPage CreateNewTabPage(ICalculationView template, string name) { var newPage = new TabPage(); newPage.Name = name; newPage.Text = name; newPage.Padding = new Padding(1, 1, 1, 1); newPage.AutoScroll = true; var tablePanel = CreateTableLayoutPanel(name, 3, 1); tablePanel.Margin = new Padding(1, 1, 1, 1); tablePanel.Padding = new Padding(0, 0, 0, 0); tablePanel.RowStyles[1] = new RowStyle(SizeType.Percent, 100F); tablePanel.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 100F); newPage.Controls.Add(tablePanel); var newGroup = CreateControlElementsPanel(name); newGroup.Margin = new Padding(0, 0, 0, 0); tablePanel.Controls.Add(newGroup); var smallTable = CreateCalculationPanel(template); tablePanel.Controls.Add(smallTable, 0, 1); var stateLabel = CreateLabel("Ready"); stateLabel.Name = "StateLabel"; tablePanel.Controls.Add(stateLabel, 0, 2); return(newPage); }
public Computation(string title, Type calculatorType, Type viewType) { Title = title; CalculatorType = calculatorType; ViewType = viewType; View = (ICalculationView)Activator.CreateInstance(viewType); }
public CalculationController(ICalculationView calcView, ICalculation calc) { if (!(calc == null || calcView == null)) { this._calc = calc; this._calcView = calcView; this._calc.Controller = this; } }
private void btnTinhFrmAll_Click(object sender, EventArgs e) { _calc = new Executor(); _calcView = (ICalculationView)this; //con cai dat config //... setValue4InputParams(); _calcView.SetInputParams(_inputParams); //CalculatingMonitor f = new CalculatingMonitor(); _calc.AddMonitors(this._lstMonitor); _calcController = new CalculationController(_calcView, _calc); //MessageBox.Show("bat dau tinh"); //MessageBox.Show(_lstMonitor.Count.ToString()); foreach (ICalculationMonitor m in this._lstMonitor) { m.Show(); } //MessageBox.Show(string.Format("GCalculationView - so luong monitor:{0}", _lstMonitor.Count)); _calcController.ReqStart(); }
private void mniReCalcCurPos_Click(object sender, EventArgs e) { if (_executor == null || _inputParams==null || _calcController==null) { return; } try { _calc = (ICalculation)_executor; _calcView = (ICalculationView)this; setValue4InputParams(); _calcController.SetCalculation(_calc); _calcController.SetView(_calcView); foreach (ICalculationMonitor m in _calc.Monitors) { m.Show(); } } catch(Exception ex) { MessageBox.Show("line 977 GLandpriceView ex=",ex.ToString()); } _calcController.ReqStart(); //_calcView.SetInputParams(_inputParams); }
// Reflection is used HERE FlowLayoutPanel CreateCalculationPanel(ICalculationView tempate) { List <GroupBox> GroupBoxes = new List <GroupBox>(); List <CheckedListBox> CLB = new List <CheckedListBox>(); List <TableLayoutPanel> Tables = new List <TableLayoutPanel>(); foreach (var member in tempate.GetType().GetProperties()) { var attr = (DisplayTitleAttribute)member.GetCustomAttribute(typeof(DisplayTitleAttribute)); if (attr == null) { continue; } switch (attr.Type) { case DataType.Bool: { if (!String.IsNullOrEmpty(attr.Subgroup)) { var clb = CLB.FirstOrDefault(c => c.Name == attr.Subgroup); var group = GroupBoxes.FirstOrDefault(g => g.Name == attr.GroupBox); var table = Tables.FirstOrDefault(g => g.Name == attr.GroupBox); if (group == null) { group = CreateGroupBox(attr.GroupBox); GroupBoxes.Add(group); table = CreateTableLayoutPanel(attr.GroupBox, 1, 2); table.GrowStyle = TableLayoutPanelGrowStyle.AddRows; Tables.Add(table); group.Controls.Add(table); } if (clb == null) { var newLbl = CreateLabel(attr.Subgroup); clb = CreateCheckListBox(attr.Subgroup, attr.GroupBox); var tbl = CreateTableLayoutPanel("", 2, 1); table.Controls.Add(tbl); tbl.Controls.Add(newLbl); tbl.Controls.Add(clb); CLB.Add(clb); } clb.Items.Add(attr.Title); } else { var newLabel = CreateLabel(attr.Title); var newCB = new CheckBox(); newCB.Name = member.Name; newCB.CheckedChanged += (s, e) => SetValueToView(member, attr, newCB.Checked.ToString()); var group = GroupBoxes.FirstOrDefault(g => g.Name == attr.GroupBox); var table = Tables.FirstOrDefault(g => g.Name == attr.GroupBox); if (group == null) { group = CreateGroupBox(attr.GroupBox); GroupBoxes.Add(group); table = CreateTableLayoutPanel(attr.GroupBox, 1, 2); Tables.Add(table); group.Controls.Add(table); } if (table.Controls.Count > 0) { table.RowCount++; } table.Controls.Add(newLabel); table.Controls.Add(newCB); } break; } case DataType.Discrete: { var newCombo = CreateComboBox(member.Name, attr.ComboValues); newCombo.SelectedIndexChanged += (s, e) => SetValueToView(member, attr, newCombo.SelectedItem.ToString()); var newLabel = CreateLabel(attr.Title); var group = GroupBoxes.FirstOrDefault(g => g.Name == attr.GroupBox); var table = Tables.FirstOrDefault(g => g.Name == attr.GroupBox); if (group == null) { group = CreateGroupBox(attr.GroupBox); GroupBoxes.Add(group); table = CreateTableLayoutPanel(attr.GroupBox, 1, 2); Tables.Add(table); group.Controls.Add(table); } if (table.Controls.Count > 0) { table.RowCount++; } table.Controls.Add(newLabel); table.Controls.Add(newCombo); break; } default: { var newLabel = CreateLabel(attr.Title); var newTB = CreateTextBox(member.Name); newTB.Leave += (s, e) => SetValueToView(member, attr, newTB.Text); var group = GroupBoxes.FirstOrDefault(g => g.Name == attr.GroupBox); var table = Tables.FirstOrDefault(g => g.Name == attr.GroupBox); if (group == null) { group = CreateGroupBox(attr.GroupBox); table = CreateTableLayoutPanel(attr.GroupBox, 1, 2); GroupBoxes.Add(group); Tables.Add(table); group.Controls.Add(table); } if (table.Controls.Count > 0) { table.RowCount++; } table.Controls.Add(newLabel, 0, table.RowCount - 1); table.Controls.Add(newTB, 1, table.RowCount - 1); break; }; } } var smallTable = CreateFlowLayoutPanel("CalculationPanel"); smallTable.Padding = new Padding(1, 1, 1, 1); smallTable.Controls.AddRange(GroupBoxes.ToArray()); return(smallTable); }
private void setupControllers() { //xemGiaDatView = this.gTableLandPriceView1 as ILandpriceDetailView; //xemGiaDatView.SetGridViews(this.grvTgdNn, this.grvTgdPnnNt, this.grvTgdPnnDt); //TnThongTinThuaDat thongTinThua = new TnThongTinThuaDat() ; //xemController=new TnXemGiaDatController(xemGiaDatView,thongTinThua); //xemGiaDatView.SetParentControl(this.dpnXemGiaDatTatCa); //xemGiaDatView.SetTablesName("sde.thua_giadat_nn", "sde.thua_giadat_pnn_nongthon", "sde.thua_giadat_pnn_dothi"); //_editGiadat = (IEditTableView)xemGiaDatView; //xemGiaDatView.SetMapView(this._mapView4thua); _calcView = (ICalculationView)this.gCalculationView1; ((ICalculationMonitor)this.gCalculatingView1).SetParentControl(dpnDangTinhGiaTatCa); ((ICalculationMonitor)this.gCalculatingView1).SetDetailView(FrmLandPriceInfo.CallMe.GetView(),FrmLandPriceInfoPublic.CallMe.GetView()); //((ICalculationMonitor)this.gCalculatingView1).SetDetailView(xemGiaDatView); if (_calcView.MonitorCount() == 0) { _calcView.AddMonitor((ICalculationMonitor)this.gCalculatingView1); } //gan ban do cho form tim kiem ((IQueryThuaView)gQueryInfoThuaView1).SetMapView(this._mapView); //((IQueryThuaView)gQueryInfoThuaView1).SetLandpriceView(this.xemGiaDatView); _calcHemView = (ICalculationView)this.gCalculationHemView1; if (_calcHemView.MonitorCount() == 0) { _calcHemView.AddMonitor((ICalculationMonitor)this.gCalculatingView1); } }
void ICalculationController.SetView(ICalculationView view) { this._calcView = view; }
public CalculationPresenter(ICalculationView view) { this.view = view; }