public ContentsSheet(Worksheet sheet, SheetFactory sheetFactory) : base(sheet) { var pricer = ControlRoot.AddControl(new Button(sheet.Range["B3"]) { Title = "Pricer" }); pricer.Clicked += () => sheetFactory.ShowSheet(s => new PricerSheet(s)); }
public PricerSheet(Worksheet sheet) : base(sheet) { _status = ControlRoot.AddControl(new StatusControl(sheet.Range["I4"], 10, 1, 6)); ControlRoot.UnhandledException += ex => { _status.Append(ex); // TODO: _log.Warn(ex); }; var marketSettings = ControlRoot.AddControl(new PropertyGridControl(sheet.Range["B3"])); var market = new DropDownSelector { Values = new[] { "Live", "Close" }.ToReadOnly(), SelectedValue = "Live" }; var valuationDate = new DateEditorControl { Value = Today }; System.Action onMarketChanged = () => valuationDate.IsDisabled = market.SelectedValue == "Live"; market.SelectedValueChanged += onMarketChanged; onMarketChanged(); marketSettings.AddProperty("Valuation Date", valuationDate); marketSettings.AddProperty("Market", market); var trades = new List <TradeRowView>(); trades.Add(new FXForwardRowView { Domestic = { Value = Eur(10000) }, Foreign = { Value = Usd(12000) }, SettlementDate = { Value = Today.AddMonths(3) }, ForwardRate = { Value = 1.2m } }); trades.Add(new FXVanillaOptionRowView { Domestic = { Value = Rub(10000) }, Foreign = { Value = Sgd(-12000) }, SettlementDate = { Value = Today.AddMonths(6) }, Strike = { Value = 1.4m } }); var tradeArea = ControlRoot.AddControl(new DynamicDataGridControl(sheet.Range["B15"], trades)); tradeArea.AddColumns(new[] { "Settlement Date", "Domestic" }); }